Ace08 Posted November 14, 2011 Posted November 14, 2011 Hi guys this will be my 1st time with dllcalls so please bear with me. a certain company was able to provide us with an encryption dll, the problem is that when i try to execute the func nothing happens.The syntax for the dll func is this: encryptFile(strPath, strSourceFile, strPassword, strMessage, strTargetFile)what i did was this:Global dll = "C:\ENC DEC DLL\EncDec.dll" $Call = DllCall(dll, " BOOLEAN", "encryptFile(c:\ENC DEC DLL, samplefile.TXT, password, unable to encrypt)") msgbox(0,"test dll", $Call)I think i'm wrong to use encryptFile(c:\ENC DEC DLL, samplefile.TXT, password, unable to encrypt) inside the DllCall but i don't know where i'm supposed to put the arguments for this function. Work smarter not harder.My First Posted Script: DataBase
FaridAgl Posted November 14, 2011 Posted November 14, 2011 Try DllOpen() like this: Global $dll = DllOpen("C:ENC DEC DLLEncDec.dll") $Call = DllCall($dll, " BOOLEAN", "encryptFile(c:ENC DEC DLL, samplefile.TXT, password, unable to encrypt)") msgbox(0,"test dll", $Call) And you missed a $ sign before the dll variable. http://faridaghili.ir
Ace08 Posted November 14, 2011 Author Posted November 14, 2011 Ohhhhh sorry about that my bad and thanks D4RKON3 for the help however i tried both your code and mine(added the missing $) but still nothing happens. i'm getting a bit frustrated here its much easier to debug a code with errors rather than those without. can you guys confirm that i used the dllcall func correctly? if so i think i should ask the company about their dll. Work smarter not harder.My First Posted Script: DataBase
Shaggi Posted November 14, 2011 Posted November 14, 2011 (edited) read up on dllcall in the help file, youre doing most wrong.. firstly though you need to find the full prototype for this function:encryptFile(strPath, strSourceFile, strPassword, strMessage, strTargetFile)which calling convention? 32/64 bit dll? what types are the arguments, c-style strings? if so, unicode / ansi / multibyte? etc e: also, what does it return, and what type? Edited November 14, 2011 by Shaggi Ever wanted to call functions in another process? ProcessCall UDFConsole stuff: Console UDFC Preprocessor for AutoIt OMG
Ace08 Posted November 15, 2011 Author Posted November 15, 2011 (edited) Thanks Shaggi for the help i did look in the help file and that is why i was able to formulate the code posted above which unfortunately is'nt working T_Tits a 64bit dll running on a 64 bit PC for the arguments i have attached the documentation belowReturns a Boolean value indicating whether the encryption is successful. SyntaxencryptFile(strPath, strSourceFile, strPassword, strMessage, strTargetFile)The encryptFile function syntax has these arguments: Part Description strPath Required (String expression). The path or location of file to be encrypted strSourceFile Required (String expression). The filename of file to be encrypted strPassword Required (String expression). The password that will be used during encryption. (Note: The password must be encrypt by the encrypt decrypt program) strMessage Required (String expression). Returning error message during encryption. If strMessage is empty (ββ) the encryption is successful otherwise, the error description during encryption will be the value for strMessage. strTargetFile Optional (String expression). The filename that will be used after the encryption. If omitted. The encrypted file will be the source filename with the extension name of βENCβ. Edited November 15, 2011 by Ace08 Work smarter not harder.My First Posted Script: DataBase
Shaggi Posted November 15, 2011 Posted November 15, 2011 (edited) are you sure this is a c/c++ dll? its weird they dont specify exact types... anyway, from the information given, you can try this: Func encryptFile($sPath, $sSourceFile, $sPass, $sMsg, $sTarget) $aRet = DllCall("C:ENC DEC DLLEncDec.dll","bool","encryptFile", _ "str",$sPath,"str",$sSourceFile,"str",$sPass,"str",$sMsg,"str",$sTarget) If NOT @Error AND IsArray($aRet) AND $aRet[0] Then Return True Else Return False EndIF EndFuncif its unicode strings, you can change each "str" to "wstr" Edited November 15, 2011 by Shaggi Ever wanted to call functions in another process? ProcessCall UDFConsole stuff: Console UDFC Preprocessor for AutoIt OMG
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