Archive: New installer script functions


New installer script functions
Hi! I just discovered this forum, and wanted to ask around to see if I'm doing something useful or wasting my time...

For my private build of NSIS 1.98, I've just about finished enabling the following new functions:
---
Download "http://www.foo.com/dl/blah.cab" "$TEMP\out.cab"
Expand "%TEMP\out.cab" "$INSTDIR"
---

Is this sort of thing old hat and already scheduled for inclusion in NSIS 2.0?

Thanks for any feedback,

Eric Lawrence
Applications Architect
Bayden Systems


There is already a DLL that can download files for you. It is called NSIS-dl, and is included in the Bin dir in your NSIS 1.98. The sources are in Contrib\NSISdl.

Another DLL written by CodeSquid can extract files from ZIPs. You can find it at Sunjammer's NSIS Archive (have a look at the FAQ for links). It would be great if you make a DLL for extracting from CAB files too, and post it here.


DLs
I took a look at the code which performs a HTTP download, and while it looks complete, it seems excessively complicated. URLMon exports a single function which will perform a file download, and adding a reference to it adds just 500 bytes to the installer... much less than the NSISDL.dll, which is ~15kb.

I would think that downloads and decompression are something central enough to make it into the engine itself.

Thanks for the feedback!


Is this function exported from WinInet.dll?
As far as I know NSISdl didn't use it deliberately because it is slow and heavy. NSISdl uses Nullsoft's JNet-lib, which uses socks for fast operations.

I don't think these functions are crucial enough to be included in the "engine". NSIS 2 provides a very easy way to call DLL functions by Sunjammer. Just write them as any other functions and NSIS will inculde the file, extract and delete it for you.


Actually, it's exported by URLMon. URLMon is always loaded in Windows and has shipped since IE3.

I've got both compression and download in my installer for a <1kb increase in output size.

But I agree, the DLL system is great, and its good that it's there.


Download code in NSIS
Thanks, this is very good if there is download code
already in the NSIS installer. I will use it, but
I have two additional questions:

1) Does anyone know if the DLL's
specified allow you to gauge progress of the download,
so I can generate a status bar (this would be from VB).

2) I would imagine that this would let my installer
check to see whether certain mandatory libraries are
available, and download the ones that are not. I
also hope to use this to check to see if certain
optional libraries for my APP are already installed,
and download them based on a user dialog (explaining
how long it will take, etc).

--For non-system files, I will use a file existence test.
But how do I do this for system files?

Can I write a script that tests the date and/or the
Windows Version of a DLL? The issue here is I need
to make sure the user has a consistent version of
the database libraries jet 3.5 and dao 3.51.

-rc


Limits...
My code does not support a progress bar, unfortunately. It would require wrapping an ugly COM interface, and since C++ is not my native language, I decided to pass.

With regard to checking system libraries-- My code checks Delphi libraries only, sorry.


NSISdl uses a progress bar if quiet mode is not used.


Great -- this clarifies what I want my script to do (it
installs a free database software program for nonprofits).

But I am not sure if there is a way to combine the
behavior of UpgradeDLL with NSISdll. That's really
want I want to do. The installer will include the
items that most users have. If the installation
takes place on an old pc, I want to have UpgradeDLL
obtain the required files from the internet, so that
they don't have to be part of the install package.

So if I can detect that the user is running an old
version of Windows95 (lacking MSVCRT.DLL or a newer
version of OLEAUT32.DLL), I can have the script end
with 2 possible scenarios (user dialogues):

1) ODB was installed successfully. Do you want to
run the program now?

2) ODB was installed, but before you run the program
you will some updates to Windows. Would you like to
automatically download and install them now? (Make sure your internet connnection is active before clicking Yes.)

Can a combination of UpgradeDLL and NSISdl.dll handle
this functionality? Do I need to use GetDLLVersion instead?
Any sample scripts I can refer to?

-rc


Edit the updgrade DLL macro you have to move after reboot from the place you tell him (where you have downloaded the file to) instead of extracting it and moving the extracted file on reboot.


how to use nsisdl to download a file from http:\abc.com \t.zip and how to extract a zip file