Sign in to follow this  
Followers 0
Jenkey1002

need help : DllCall

4 posts in this topic

Please anyone help me convert this code from vb.net to autoit

<DllImport("decrypt_dll.dll", CallingConvention:=CallingConvention.Cdecl)> _

Public Shared Sub _encrypt(ByVal buf As Byte(), ByVal length As Integer)

End Sub

<DllImport("decrypt_dll.dll", CallingConvention:=CallingConvention.Cdecl)> _

Public Shared Sub _decrypt(ByVal buf As Byte(), ByVal length As Integer)

End Sub

my code in autoit but it doesnt work

$encrypt_dll = DllOpen("decrypt_dll.dll")

$InByteArr = DllStructCreate("chr[" & $size + 1 & "]")

DllStructSetData($InByteArr, 1,$binary)

ConsoleWrite($InByteArr & @CRLF)

$OutByteArr = DllStructCreate("chr[" & $size + 1 & "]")

$ret2 = DllCall($encrypt_dll,"ptr","_decrypt","ptr",DllStructGetPtr($InByteArr),"long",$size)

$CompressedBuffer = DllStructCreate("byte[" & $size + 1 & "]", $ret2)

$RetBinary = DllStructGetData($CompressedBuffer, 1)

sorry Im a new member & autoit nobie

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You need to add :cdecl to the return type so "ptr:cdecl" not "ptr". See the help for dllcall.

Also, make sure the dll is in the script folder or use the full path.

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

You need to add :cdecl to the return type so "ptr:cdecl" not "ptr". See the help for dllcall.

Also, make sure the dll is in the script folder or use the full path.

hi martin

I tried several times but doesnt work

here's link "decryptdll.dll" & encrypted data : http://www.mediafire.com/?dss614te9m26l45

waitting your advice

Share this post


Link to post
Share on other sites

Can you give a link to the VB example, and better still a link to information on decrypt_dll.dll?

If the function _dcrypt returns a pointer to a buffer how do you know how big the buffer is? How do you even know it returns a pointer? You have used $ize + 1 but where does $size come from?

Also you have used a char array but the function definition says byte so that could also be significant. But at the moment I don't have enough information about the function to make a sensible suggestion.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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