Archive: Using DLL's


Using DLL's
Hi,

I'm trying to use the XZip.dll which lets you add and delete files from a zip archive which is what I need to do.

http://xstandard.com/printer-friendl...0-2267ED6763A7

I'm using it fine with visual basic, but I'm trying to get it to work in the nullsoft installer.

In visual basic I told the dll to do something such as:
objZip.Delete "path/file", "\zipfile.zip"

Is there anyway to do something similar in the nullsoft installer? The only other option I can find is to use the 7za.exe command line style but I would rather not do this.


You could probably call the dll functions with the System plugin.

-Stu


I've been looking at that and I am totaly confused.

I'm trying something like:

StrCpy $0 "$INSTDIR\file"
StrCpy $1 "$INSTDIR\zip"
StrCpy $2 "True"
StrCpy $3 "file/path/in/zip"
System::Call 'XZip::Pack(i, *i, t) i(r0, r1, r2, r3) .r4'

But I really have no idea what I am doing, and the documentation does not make sense to me


Hi RyanC,
After reading the link that you provided for the command that you want to execute:

Method Sub Pack(sFilePath As String, sArchive As String, [bStorePath As Boolean = False], [sNewPath As String], [lCompressionLevel As Long = -1])
Add file or folder to an archive. Compression level 1 is minimum, level 9 is maximum, all other values default to level 6.

I think that your call should look like this:
StrCpy $0 "$INSTDIR\file"
StrCpy $1 "$INSTDIR\zip"
StrCpy $2 "True"
StrCpy $3 "file/path/in/zip"
StrCpy $4 6 ; compression level
System::Call 'XZip::Pack(t r0, t r1, t r2, t r3, i r4)'

I am not sure if the function returns anything out, not by reading the API reference. I'll try to test it myself since I am not sure about $2 either (it is a boolean so it might be 'i 1' or 'i 0' instead of 't r2').
Hope this helps
CF

Thanks for the reply, I wont dive in so deeply for the first project next time ;-).

I have tried the method suggested, using both boolean and string with no success.

It does appear to report an error, at least the only thing I ever get back from it is "error".

If you test it yourself and get something to work please let me know. I will keep on it and see if I can get it working.


Boolean values are not string values. They are integer values of 1 or 0.
You should also use SetOutPath to tell the System plugin where the DLL is located.

-Stu


Currently making it as simple as possible using:


setoutpath $SYSDIR

StrCpy $0 "C:\test.txt"
StrCpy $1 "C:\test.zip"
;StrCpy $2 "false"
StrCpy $3 ""
StrCpy $4 6 ; compression level
System::Call 'XZip::Pack(t r0, t r1, i 0, t r3, i r4)' r5


but no luck. Have tried a whole combination or different data types for the call, all string, correct boolean\interger\string combinations etc but with no luck.

The API mentions I should be able to call

system::call 'XZip::ErrorDescription' r6

But i'm not getting anything in return.

I'll give it a try myself.
Edit: Could you please attach the DLL file in a Zip? I don't feel like giving them my e-mail address.

-Stu


One more thing. Did you register the DLL with RegDll first?

-Stu


Yes the dll is registered.


I guess it doesn't work because it's an ActiveX DLL.
There's nothing wrong with the function call, because I've checked it with PE_Explorer.

-Stu


thanks for the help and info