Jump to content
Sign in to follow this  
Chika95

Md5Hash.dll problem

Recommended Posts

Chika95

I've been trying to get this to work, but I can't seem to get the plugin to open properly

When I run this simple test code:

$PluginHandle = PluginOpen(@ScriptDir & "\MD5Hash.dll")
;$PluginHandle = PluginOpen("D:\temp\MD5Hash.dll")
    
    IF FileExists(@ScriptDir & "\MD5Hash.dll") = 0 Then
        msgbox(0,"Error","File does not exsist")
        Exit
    EndIf   
    
    IF $PluginHandle = 0 then
        msgbox(0,"Error","plugin did not open properly")
        Exit
    EndIf

$Hash = MD5Hash("lolhi2u!", 2, True)

PluginClose($PluginHandle)


msgbox(0,"Hash",$Hash)

I get the Error message box

Now of course I have MD5Hash.dll(you can DL it from this post:http://www.autoitscript.com/forum/index.php?showtopic=21010, or direction from:Md5Hash.dll , in the same directory as this test script. I've tested both using @ScriptDir, as well as the actual script directory. I've tried using v3.2.12.0 as well as v3.2.11.12 (beta). Any help would be appreciated.

Share this post


Link to post
Share on other sites
Siao

It opens properly (comment out your error checking, and you'll see that MD5Hash function works just fine), it's just that the return value of PluginOpen is not what's documented. That "PluginHandle" is a zero-based index number. On first PluginOpen it returns 0. If you open another plugin, that will be 1. Etc. But if it fails to open plugin, it returns 0 too and there's no @error set, so that's pretty broken.

If you really want to check if plugin was loaded successfully, do

$a = DllCall('Kernel32.dl','hwnd','GetModuleHandle', 'str','MD5Hash.dll')
If Not $a[0] Then MsgBox(0,'Error','Plugin not loaded')

"be smart, drink your wine"

Share this post


Link to post
Share on other sites
Chika95

Thanks so much both of you. I had been wracking my brain over this, and like always its such a simple fix...

This works for all who are interesteD:

#AutoIt3Wrapper_plugin_funcs = MD5Hash
$PluginHandle = PluginOpen(@ScriptDir & "\MD5Hash.dll")
;$PluginHandle = PluginOpen("D:\temp\MD5Hash.dll")
    
    IF FileExists(@ScriptDir & "\MD5Hash.dll") = 0 Then
        msgbox(0,"Error","File does not exsist")
        Exit
    EndIf   
    
    $a = DllCall('Kernel32.dll','hwnd','GetModuleHandle', 'str','MD5Hash.dll')
    If not $a[0] Then MsgBox(0,'Error','Plugin not loaded')
    

$Hash = MD5Hash("lolhi2u!", 2, True)

PluginClose($PluginHandle)

msgbox(0,"Hash",$Hash)
Edited by BotXpert

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  

×