Sign in to follow this  
Followers 0
pinkfoyd

[binary.dll] Bug in it ?

5 posts in this topic

#1 ·  Posted (edited)

Hi all !

Thanks to SmOke_N I can use again the binary.dll to extract hexadecimal data from a file.

But i think there are a bug in the dll, she don't want to be executed 13 times, 12 yes but at 13 the dll return nothing.

Here is a simple exemple :

for $loop = 1 to 20
$resr = DllCall("binary.dll", "int:cdecl", "FileReadBinary", "str", "binary.dll", "int", 10, "int", 10, "str", "")
ConsoleWrite($loop & ":" & $resr[4] & @CRLF)
next

the script return this in the debug windows :

>Running:(3.2.8.1):C:\Program Files\AutoIt3\autoit3.exe "H:\__CD Install__\Programmes\AutoIt 3.2.4.9\Addons\binary_dll\binary_demo.au3"

1:0000FFFF0000B8000000

2:0000FFFF0000B8000000

3:0000FFFF0000B8000000

4:0000FFFF0000B8000000

5:0000FFFF0000B8000000

6:0000FFFF0000B8000000

7:0000FFFF0000B8000000

8:0000FFFF0000B8000000

9:0000FFFF0000B8000000

10:0000FFFF0000B8000000

11:0000FFFF0000B8000000

12:0000FFFF0000B8000000

13:

14:

15:

16:

17:

18:

19:

20:

+>15:33:46 AutoIT3.exe ended.rc:0

+>15:33:47 AutoIt3Wrapper Finished

>Exit code: 0 Time: 1.747

Someone have a solution ? thk !

PS : i try to use DLLOPEN & DLLCLOSE, same result.

Edited by pinkfoyd

Share this post


Link to post
Share on other sites

anyone any idea ?

Share this post


Link to post
Share on other sites

No idea what the issue is, and no intention of downloading an unknown .dll and running it.

One thing I notice is a new open/close cycle for every call. Perhaps this will make a difference, but probably not:

$hDll = DllOpen("binary.dll")
for $loop = 1 to 20
$resr = DllCall($hDll, "int:cdecl", "FileReadBinary", "str", "binary.dll", "int", 10, "int", 10, "str", "")
ConsoleWrite($loop & ":" & $resr[4] & @CRLF)
next
DllClose($hDll)

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

No problem PsaltyDS, i understand if you don't want to test it ;)

( unfortunely i can't find again in the forum where i found this dll, that a long time ago...)

And like i said it, i try like you the open and close each time, but ame way, after 12 run, the dllcall doesn't work anymore :)

EDIT : understand nothing... i juste try your example ( witch is the same like i have tried, and today this work !!!!)

The mystery of computer science ^^

Thanks !

EDIT 2 : Ok ! I have it, but i can't explain why :

This work :

$hDll = DllOpen("binary.dll")

for $loop = 1 to 20
     $resr = DllCall($hDll, "int:cdecl", "FileReadBinary", "str", "binary.dll", "int", 10, "int", 10, "str", "")
     ConsoleWrite($loop & ":" & $resr[4] & @CRLF)
next

DllClose($hDll)

And this does'nt after 12 elements :

for $loop = 1 to 20
     $hDll = DllOpen("binary.dll")

     $resr = DllCall($hDll, "int:cdecl", "FileReadBinary", "str", "binary.dll", "int", 10, "int", 10, "str", "")
     ConsoleWrite($loop & ":" & $resr[4] & @CRLF)

     DllClose($hDll)
next
Edited by pinkfoyd

Share this post


Link to post
Share on other sites

EDIT 2 : Ok ! I have it, but i can't explain why :

This work :

$hDll = DllOpen("binary.dll")

for $loop = 1 to 20
     $resr = DllCall($hDll, "int:cdecl", "FileReadBinary", "str", "binary.dll", "int", 10, "int", 10, "str", "")
     ConsoleWrite($loop & ":" & $resr[4] & @CRLF)
next

DllClose($hDll)

And this does'nt after 12 elements :

for $loop = 1 to 20
     $hDll = DllOpen("binary.dll")

     $resr = DllCall($hDll, "int:cdecl", "FileReadBinary", "str", "binary.dll", "int", 10, "int", 10, "str", "")
     ConsoleWrite($loop & ":" & $resr[4] & @CRLF)

     DllClose($hDll)
next
We're over my head on this, so I hope one of the smart people is going to jump in soon: But it would appear there is something 'dirty' about the way that DLL closes. Some allocation of a resource or something is left behind to cause problems after a few open/close cycles.

This is where I would walk across the hall to one of the C++ guys and ask about it, but if you don't have source code or access to wherever that DLL came from, I'm not sure what you do to debug now.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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