monoceres Posted March 26, 2008 Posted March 26, 2008 Hi!I just found this MD5/SHA1 dll and I can't figure out why it's not working calling it...Here's my code:Dim $file="test.jpg" Dim $hash $t=DllCall("hashLib.dll","int","FileSHA1","str",$file,"int*",$hash) If @error Then MsgBox(16,"Error","Error calling dll") MsgBox(0,$t,$hash)I've also tried with str* and all kinds of types instead of int* but nothings works Notice that I don't get a @error, it's just that $hash and $t is empty Broken link? PM me and I'll send you the file!
FreeFry Posted March 26, 2008 Posted March 26, 2008 I don't know what functions and what syntaxes they have that exists in that dll of yours, but I see one error in the MsgBox you have at the end: If the function call fails then @error is set to 1. Otherwise an array is returned that contains the function return value and a copy of all the parameters (including parameters that the function may have modified when passed by reference). $return[0] = function return value $return[1] = param1 $return[2] = param2 that means, change: MsgBox(0,$t,$hash) To MsgBox(0,$t[0],$hash)
monoceres Posted March 26, 2008 Author Posted March 26, 2008 Fixed.This is the textfile that was included in the download (The dll is made for some wacked out script language)HashLib for Macro Scheduler.Copyright MJT Net Ltd 2006Provides following functions:FileMD5 - Return MD5 hash of a fileFileSHA1 - Return SHA1 hash of a fileStringMD5 - Return MD5 hash of a stringStringSHA1 - Return SHA1 hash of a stringAll functions take two parameters:File/String,return_bufferFunctions return length of hash or zero if an error occurred.Usage examples://Put Hashlib.dll in script directoryLet>HashLib=%SCRIPT_DIR%\HashLib.dll//Get SHA1 hash of a fileLibFunc>Hashlib,FileSHA1,r,c:\somefile.exe,bufMid>r2,1,r,hashMessageModal>Hash: %hash%//Get MD5 hash of a fileLibFunc>Hashlib,FileMD5,r,c:\somefile.exe,bufMid>r2,1,r,hashMessageModal>Hash: %hash%//Get MD5 hash of a stringLibFunc>Hashlib,StringMD5,r,Hello World,bufMid>r2,1,r,hashMessageModal>Hash: %hash%//Get SHA1 hash of a fileLibFunc>Hashlib,StringSHA1,r,Hello World,bufMid>r2,1,r,hashMessageModal>Hash: %hash%Maybe the dll only works in this language, but I since it's an dll I kind of thought that it should work in autoit Broken link? PM me and I'll send you the file!
monoceres Posted March 26, 2008 Author Posted March 26, 2008 (edited) Edit: Double post Edited March 26, 2008 by monoceres Broken link? PM me and I'll send you the file!
monoceres Posted March 26, 2008 Author Posted March 26, 2008 (edited) Sure thing, I attach it Dll can be found: http://www.autoitscript.com/forum/index.php?showtopic=67435 Edited July 27, 2008 by monoceres Broken link? PM me and I'll send you the file!
rover Posted March 27, 2008 Posted March 27, 2008 (edited) hash is returned in array from DllCall. a good example of why its best to use ConsoleWrite to view array elements returned from DllCall for some reason this works. you would think $hash probably needs a struct. perhaps just used as buffer then emptied? need a 'Siao' calibre answer here. Edit: replacing $hash with "" or 0 also works $t = DllCall("hashLib.dll","int","FileSHA1","str",$file,"str",0) $t = DllCall("hashLib.dll","int","FileSHA1","str",$file,"str","")oÝ÷ Ù«¢+Ù¥´ÀÌØí¥±ôÅÕ½ÐíÑÍй©ÁÅÕ½Ðì)¥´ÀÌØí¡Í °ÀÌØíÐ(ÀÌØíÐô±± ±° ÅÕ½Ðí¡Í¡1¥¹±°ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½Ðí¥±M!ÄÅÕ½Ðì°ÅÕ½ÐíÍÑÈÅÕ½Ðì°ÀÌØí¥±°ÅÕ½ÐíÍÑÈÅÕ½Ðì°ÀÌØí¡Í ¤) ½¹Í½±]É¥Ñ Ìäì´ÐìÀÌØíÑlÁtôÌäìµÀìÀÌØíÑlÁtµÀìɱµÀìÌäìÐìÉɽȽèÌäìµÀìÉɽȵÀìɱ¤ìÉÑÕɸ½) ½¹Í½±]É¥Ñ Ìäì´ÐìÀÌØíÑlÅtôÌäìµÀìÀÌØíÑlÅtµÀìɱµÀìɱ¤ì¥±¹µ) ½¹Í½±]É¥Ñ Ìäì´ÐìÀÌØíÑlÉtôÌäìµÀìÀÌØíÑlÉtµÀìɱµÀìɱ¤ì¡Í ) ½¹Í½±]É¥Ñ Ìäì´ÐìÀÌØí¡Í ôÌäìµÀìÀÌØí¡Í µÀìɱµÀìɱ¤((ìչѥ½¸ÉÑÕɸٱÕèÀÌØíÑlÁt(ìÌÈ´¥±5Ô(ìÐÀ´¥±M!Ä(ìÌÈ´MÑÉ¥¹5Ô(ìÐÀ´MÑÉ¥¹M!Ä Edited March 27, 2008 by rover I see fascists...
monoceres Posted March 27, 2008 Author Posted March 27, 2008 Thank you so very, very much Broken link? PM me and I'll send you the file!
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