Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 16th June 2001, 12:06   #1
spanky
Senior Member
 
Join Date: May 2000
Posts: 295
Send a message via ICQ to spanky
I would like to add an option to install an executable as a system service. I am quite sure this would be done through the registry but I am not sure where this is done.

I would also like the option to appear only if the user is running Windows NT. Is it possible to hide sections based on string values? I have not been able to get this to work.

all work and no play makes jack a dull boy
spanky is offline   Reply With Quote
Old 23rd June 2001, 18:20   #2
arundel
Junior Member
 
Join Date: Jun 2001
Posts: 6
I just had a quick look at my registry and the path for the WinNT/W2K system services is:
HKLM, SYSTEM\Services

A good example of a W2K System Service which uses it's own executable is e.g. Telnet (TlntSvr).
Have a look at the structure and you should be able to put up a new service with NSIS.

For more information about Winows System Services goto:
http://msdn.microsoft.com/library/
and search for system services.

I'm not sure what you mean by "hide sections based on string values". If you mean that you would like to create a section which does not show up in the install-options just create a Section called "".

If you need to detect the Windows Version of a system I recommend the following address:

http://www.firehose.net/free/nsis/functions.html

Good luck!
arundel is offline   Reply With Quote
Old 24th June 2001, 00:01   #3
Edgewize
Member
 
Join Date: Apr 2001
Posts: 89
Unfortunately, section hiding/disabling is done at compile time and not runtime. So you can't have certain sections be only for Win9x or WinNT.
Edgewize is offline   Reply With Quote
Old 24th June 2001, 01:15   #4
arundel
Junior Member
 
Join Date: Jun 2001
Posts: 6
So you want to have s.th. like Section "Install as System Service" which does only appear when the user's OS is NT or W2K or whatever...

Perhaps this will work:

Section .onInit
Call GetWindowsVersion

StrCmp $0 'NT' 2 lbl_doIT ''
StrCmp $0 '2000' lbl_doIT ''

;The $0 Value will be assigned by the
;GetWindowsVersion from
;http://www.firehose.net/free/nsis/functions.html#GetWindows
;Version

StrCpy $1 ""
Goto lbl_end

lbl_doIT:
StrCpy $1 'Install as System Service'

lbl_end:

SectionEnd


Section $1
StrCmp $1 'Install as System Service' '' lbl_skip

BLABLA...

lbl_skip:
SectionEnd

Could this work? Depends on if NSIS first collects all the Sections (then $1 will be unassigned and the section won't install even if your OS is NT/W2K) or if it does Section .oninit before that (which then should work).

I'm not quite sure. Just give it a try!

P.S.:
Otherwise you'll just have to allow every-OS-user to select this Section (Install as System Service) for installation and before all the stuff in the section make a GetWindowsVersion detect and if the OS is not NT/W2K just skip the Section with an explanation, like MessageBox MB_OK "Only Windows NT/2000 users can install a system service"
arundel is offline   Reply With Quote
Old 24th June 2001, 05:28   #5
Edgewize
Member
 
Join Date: Apr 2001
Posts: 89
Sections are created at compile-time, unfortunately, and variables and functions are assigned at runtime. So the only way to do it is to have the section be visible all the time, and simply have it do nothing if the target computer isn't NT.
Edgewize is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump