Archive: Using NSIS for Install based on reg keys


Using NSIS for Install based on reg keys
Hey everyone...

I am a serious noob at NSIS, and this is probably very easy to do, I just cant figure it out. I have to write a program that will, based on reading a series of reg keys default to a certain install routine. here's what I mean:

1) Start the install with a basic intro.
2) Read a series of registry keys, and based on those keys, display a list of what is and what isn't installed, then automatically check off what needs to be installed.
3) I need to install Microsoft Hotfixes that a computer is missing with the silent switch set. (IE: /q or /x etc) Basically, I am trying to use NSIS to envoke silent installs of programs, not actually copying files or creating uninstall routines.

Could someone show me/give me a framework/template for something like this?

Much Appreciated! :D


i'm a bit of a noob too, so i can't give you an exact answer, but i can't see any technical reason why you couldn't roughly do what you are asking.

one option is to simply build a script that checks every hotfix you code in, and apply it as required. it wouldn't be as pretty as you painted in your example, but you could certainly use DetailPrint to let the user know what was going on.


for each hofix i would basically do :

1) use ReadRegStr to read the registry value/ find out if it exists. (1)
2) use StrCmp to find out if it is something requiring updating (1)
3) update if so, else do next hotfix


notes :

(1) for strings only, there are functions to for non-strings

- some microsoft updates cannont be done automatically via NSIS, AFAIK. only those that use update.exe or come packaged in their own .exe.


Re: Installs
Can I run the Qxxxxxx.exe or KBxxxxxxx.exe patches from MS using some sort of run command inside of NSIS based on wheather a reg key has a certain value?


Sure, use StrCmp to compare the value you have read from the key.


a) in case i confused/worried you. what i was referring to above was that some updates only get installed via an .inf - i don't know how you would do that via NSIS

b) you should be able to run the update files by Exec or ExecWait

c) i would be interested in using your code once your finished :)


To install from an .inf file use this command

ExecWait '$SYSDIR\rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 "path to inf"'

Vytautas :D

Originally posted by blayde

c) i would be interested in using your code once your finished :)