pinkfoyd Posted October 10, 2007 Share Posted October 10, 2007 (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) nextthe 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:0000FFFF0000B80000002:0000FFFF0000B80000003:0000FFFF0000B80000004:0000FFFF0000B80000005:0000FFFF0000B80000006:0000FFFF0000B80000007:0000FFFF0000B80000008:0000FFFF0000B80000009:0000FFFF0000B800000010:0000FFFF0000B800000011:0000FFFF0000B800000012:0000FFFF0000B800000013: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.747Someone have a solution ? thk !PS : i try to use DLLOPEN & DLLCLOSE, same result. Edited October 10, 2007 by pinkfoyd Link to comment Share on other sites More sharing options...
pinkfoyd Posted October 12, 2007 Author Share Posted October 12, 2007 anyone any idea ? Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 12, 2007 Share Posted October 12, 2007 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 Link to comment Share on other sites More sharing options...
pinkfoyd Posted October 15, 2007 Author Share Posted October 15, 2007 (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 October 15, 2007 by pinkfoyd Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 15, 2007 Share Posted October 15, 2007 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 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