PDA

View Full Version : Calling a dll



NewsArchive
06-12-2007, 04:24 AM
Hi all,
I'm trying to encrypt a variable. Let me explain my idea: the user
must enter the connection string for MS-SQL so I ask for Server,
database, user and password. I will save that values in an ini.file
but, obviously, password must be encrypted.
To encrypt the password I created a dll with clarion that use
jpblowfish. The function is called MCS_Encrypt(STRING, *STRING),LONG
and I call it from SetupBuilder with this sentence:
Call DLL "c:\Wsource\NEW_MCS_TEST\dlls\encrypt_test.dll" -- Function
"MCS_Encrypt" (STRING,*STRING) (%MCS_CLAVE%,%MCS_PASSWORD%)
For any reason the function is not being called (I put messages
inside it). What can I do?
Thanks in advance.

--
Mauricio
Copenhague, Dinamarca

NewsArchive
06-12-2007, 04:29 AM
Mauricio,

Make sure your are supporting the correct calling convention, compile the
DLL as LOCAL, etc.

And of course, check the %_SB_ERRORCODE% value to see if the function
returns an error code.

HTH,

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 6.5
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
06-13-2007, 08:10 AM
Hi Friedrich,
dll is compiled as local. I tried call it as stdcall and cdecl but
nothing happens. I put messages inside this dll but it seems that is
not passing for those points.
After calling dll I put a message showing %_SB_ERRORCODE% and this
is 0. Any ideas?
Thanks in advance.

--
Mauricio
Copenhague, Dinamarca

NewsArchive
06-13-2007, 08:10 AM
Mauricio,

Sorry, I have no idea. Only one note. In the "normal" Windows World
function names are case sensitive. So if you export MSC_ENCRYPT but you
call MCS_Encrypt then a DLL function call will fail.

I would suggest to check the SB6 Example Package. It comes with a Clarion
DLL source code demo. Perhaps this gives you an idea?

Does this help?

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 6.5
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
06-13-2007, 08:10 AM
Ok, some news. I followed your example and I compiled a prj file. I put
a message before call the dll (in SB) that is showed. After calling the
dll I put another message but this has gone. It seems that the program
stop after call my dll. I didn't get any kind of message.
I read a previous message about case sensitive function names so I have
been very carefull about this.
If you want I can post my sb6 file and my prj file here. If you have
any other idea with this news, please, tell me.
Thanks again.

Mauricio

NewsArchive
06-13-2007, 08:10 AM
Hi Mauricio,

IMO, your DLL "destroys" the stack and so you don't see the other test
message. There is no (known) bug in that installer function, so if you are
interested and you need quick results, you can send the files to our
Consulting Dept. You can send the project and dll source codes to
consulting@lindersoft.com and someone from our Consulting Dept. will get
back to you within the next 24 hours. If it turns out that your problem
was caused by a SB6 bug then no Consulting fee will be charged.

Of course, you can also post the files here.

Friedrich

NewsArchive
06-13-2007, 09:06 AM
Problem solved with the help of Friedrich.
The problem was in the prototype of my function, I replaced STRING,
*STRING for *CSTRING, *CSTRING and now works like a charm.
Thanks again, Friedrich!!!!

Mauricio