Archive: Custom page failed on IIS 5.0


Custom page failed on IIS 5.0
Hello,

I'm writing an installer for my package and I have a problem
with IIS 5.0 (win2000).
I want to show the list of available server running on IIS in a custom page.
I use the latest NSIS 2.43 and the same script on a Win2000 (IIS 5.0), XP (IIS 5.1) and Server 2003 (IIS 6.0)
It works fine on XP and 2003 but not on 2000, I really don't understand why.
Is there something specific to IIS 5.0 ???


I have a custom page
Page custom PickWebsite ValidateCustom
to choose between IIS server available.

To get this list, I use a vbs script :
Function GetWebsites
; Output the VBScript
FileOpen $4 "$PLUGINSDIR\GetWebsites.vbs" w
FileWrite $4 'Set IISOBJ = getObject("IIS://localhost/" & "w3svc")$\n'
FileWrite $4 'Set objFSO = CreateObject("Scripting.FileSystemObject")$\n'
FileWrite $4 'Set objTextFile = objFSO.OpenTextFile("$PLUGINSDIR\websites.ini", 8, True)$\n'
FileWrite $4 'AllSites = ""$\n'
FileWrite $4 'for each Web in IISOBJ$\n'
FileWrite $4 'if (Web.Class = "IIsWebServer") then$\n'
FileWrite $4 'Set IISWebSite = getObject("IIS://localhost/" & "w3svc" & "/" & Web.Name)$\n'
FileWrite $4 'Set IISWebSiteRoot = getObject("IIS://localhost/" & "w3svc" & "/" & Web.Name & "/root")$\n'
FileWrite $4 'AllSites = AllSites & "|" & IISWebSite.ServerComment$\n'
FileWrite $4 'objTextFile.WriteLine("[" & IISWebSite.ServerComment & "]")$\n'
FileWrite $4 'objTextFile.WriteLine("Path=" & IISWebSiteRoot.Path)$\n'
FileWrite $4 'objTextFile.WriteLine("Name=" & Web.Name)$\n'
FileWrite $4 'objTextFile.WriteLine("LogDir=" & IISWebSite.LogFileDirectory & "/w3svc/" & Web.Name & "/")$\n'
FileWrite $4 'objTextFile.WriteLine("")$\n'
FileWrite $4 'Set IISWebSiteRoot = nothing$\n'
FileWrite $4 'Set IISWebSiteLogDir = nothing$\n'
FileWrite $4 'Set IISWebSite = Nothing$\n'
FileWrite $4 'end if$\n'
FileWrite $4 'next$\n'
FileWrite $4 'objTextFile.WriteLine("[Websites]")$\n'
FileWrite $4 'objTextFile.WriteLine("AllSites=" & Right(AllSites, Len(AllSites)-1))$\n'
FileWrite $4 'objTextFile.Close$\n'
FileWrite $4 'Set objFSO = Nothing$\n'
FileWrite $4 'Set objTextFile = Nothing$\n'
FileWrite $4 'Set IISOBj = Nothing$\n'
FileClose $4

; Execute the script
nsExec::Exec /TIMEOUT=20000 '"$SYSDIR\cscript.exe" "$PLUGINSDIR\GetWebsites.vbs"'
FunctionEnd

which return the list of server available in AllSites.
(ie AllSites = "Default Web Server|MyDomain.com Server")

When I populate this value in pick_website.ini


function WriteIni

WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Settings' 'NumFields' '4'

WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 1' 'Type' 'Label'
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 1' 'Text' 'Please Select which Web Site to set the application to use:'
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 1' 'Left' '0'
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 1' 'Right' '-1'
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 1' 'Top' '0'
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 1' 'Bottom' '10'

WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 2' 'Type' 'Droplist'
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 2' 'Text' 'droplist'
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 2' 'ListItems' ''
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 2' 'Left' '25'
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 2' 'Right' '150'
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 2' 'Top' '10'
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 2' 'Bottom' '22'

WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 3' 'Type' 'label'
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 3' 'Text' 'Directory for the application (leave blank for default) :'
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 3' 'Left' '0'
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 3' 'Right' '-1'
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 3' 'Top' '30'
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 3' 'Bottom' '40'

WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 4' 'Type' 'text'
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 4' 'Text' 'webPath'
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 4' 'State' ''
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 4' 'Left' '25'
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 4' 'Right' '150'
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 4' 'Top' '40'
WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 4' 'Bottom' '52'

FunctionEnd


The PickWebsite is here :

Function PickWebsite
Call GetWebsites
Call WriteIni
ReadINIStr $0 "$PLUGINSDIR\websites.ini" "Websites" "AllSites"
WriteINIStr "$PLUGINSDIR\pick_website.ini" "Field 2" "ListItems" $0
!insertmacro MUI_HEADER_TEXT "Webserver Configuration" "Choose the website and path that your installation will reside at."
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "pick_website.ini"
!insertmacro MUI_INSTALLOPTIONS_SHOW
FunctionEnd

Any help welcome !

Laurent


My suggestion would be to run your VBScript by itself on Windows 2000 to make sure it's returning the correct values before trying to troubleshoot NSIS.

Also, when you write files for Windows, make sure you end each line with both a carriage return and a line feed. In you example, you only have a line feed. Use $\r$\n at the end of each line of text.


Thanks for your very fast reply !!! :)

I've ran the vbs script on Win2000 and it works fine.
I've also added a MessageBox

ReadINIStr $0 "$PLUGINSDIR\websites.ini" "Websites" "AllSites"
WriteINIStr "$PLUGINSDIR\pick_website.ini" "Field 2" "ListItems" $0
MessageBox MB_OK "Debug $0"

to check IIS value and it was fine also.

Will add \r\n as you suggest.....thanks !


No way ....
If I use ListBox instead of Droplist it works ... the list
of website is displayed. Combobox fails.
As I need user to select only one website, listbox is not
an option.

If someone has a any idea why listbox works and not droplist or combobox ....
Any idea welcome...was not able to find anything like this on google !

Laurent

PS: I have this problem on Win2000, it works fine on XP and 2003 with droplist (same script with same NSIS version).


On droplist (field 2), try using a higher value for the "bottom" setting.

See this thread:
http://forums.winamp.com/showthread....hreadid=263440


Great ! :)
It works fine !

Many thanks to you !

Laurent


Sadly, someone report me there is still an issue
with Windows server 2003 R2 enterprise x64 Edition (SP2).
I have no problem with 2003 R2 32bits....
Does anyone have any idea ?
Thanks !

See http://www.w3perl.com/Immagine.jpg


Sure you don't have a load of ||| etc in the file?

Stu


will check....


The string send is :

Default Web Site|SharePoint Central Administration v3|default|SharePoint - LinkedCube.dsgroup.it|SharePoint - 23064|Office Server Web Services

The file :

WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 2' 'Type' 'Droplist'

WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 2' 'Text' 'droplist'

WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 2' 'ListItems' ''

WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 2' 'Left' '25'

WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 2' 'Right' '150'

WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 2' 'Top' '10'

WriteIniStr '$PLUGINSDIR\pick_website.ini' 'Field 2' 'Bottom' '500'

Any hint ?