Metropoli BBS
VIEWER: oemnsvnp.inf MODE: TEXT (LATIN1)
;-----------------------------------------------------------------------
; OPTION TYPE
; -----------
; This identifies the Option type we are dealing with.  The different
; possible types are:
;
; COMPUTER, VIDEO, POINTER, KEYBOARD, LAYOUT, SCSI, PRINTER, ...
;-----------------------------------------------------------------------
[Identification]
	OptionType=NetService

;-----------------------------------------------------------------------
; OPTION LIST
; -----------
; This section lists the OEM Option key names.  These keys are locale
; independent and used to represent the option in a locale independent
; manner.
;
;-----------------------------------------------------------------------
[Options]
	NPrinter = !SERVICE_WIN32_OWN_PROCESS, !SERVICE_ERROR_NORMAL, "%SystemRoot%\System32\"#(Files-NPrinterService, $(Option), 2) , 7

;-----------------------------------------------------------------------
; LANGUAGES SUPPORTED
; -------------------
;
; The languages supported by the OEM INF, For every language supported
; we need to have a separate text section for every displayable text
; section.
;
;-----------------------------------------------------------------------
[LanguagesSupported]
	GER = Deutsch

[NPrinterDependencies]
	+NetworkProvider
	NWSIpx32

;-----------------------------------------------------------------------
; OPTION TEXT SECTION
; -------------------
; These are text strings used to identify the option to the user.  There
; are separate sections for each language supported.  The format of the
; section name is "OptionsText" concatenated with the Language represented
; by the section.
;
;-----------------------------------------------------------------------

[OptionsTextGER]
    NPrinter  = "Novell NPrinter Dienst für NT"

;---------------------------------------------------------------------------
; 1. Identify
;
; DESCRIPTION:   To verify that this INF deals with the same type of options
;                as we are choosing currently.
;
; INPUT:         None
;
; OUTPUT:        $($R0): STATUS: STATUS_SUCCESSFUL
;                $($R1): Option Type (COMPUTER ...)
;                $($R2): Diskette description
;---------------------------------------------------------------------------

[Identify]
    ;
    ;
    read-syms Identification

    set Status     = STATUS_SUCCESSFUL
    set Identifier = $(OptionType)
    set Media      = #("Source Media Descriptions", 1, 1)

    Return $(Status) $(Identifier) $(Media)

;------------------------------------------------------------------------
; 2. ReturnOptions:
;
; DESCRIPTION:   To return the option list supported by this INF and the
;                localised text list representing the options.
;
;
; INPUT:         $($0):  Language used. ( ENG | FRN | ... )
;
; OUTPUT:        $($R0): STATUS: STATUS_SUCCESSFUL |
;                                STATUS_NOLANGUAGE
;                                STATUS_FAILED
;
;                $($R1): Option List
;                $($R2): Option Text List
;------------------------------------------------------------------------

[ReturnOptions]
    ;
    ;
    set Status        = STATUS_FAILED
    set OptionList     = {}
    set OptionTextList = {}

    ;
    ; Check if the language requested is supported
    ;
    set LanguageList = ^(LanguagesSupported, 0)
    Ifcontains(i) $($0) in $(LanguageList)
        goto returnoptions
    else
        set Status = STATUS_NOLANGUAGE
        goto finish_ReturnOptions
    endif

    ;
    ; form a list of all the options and another of the text representing
    ;

returnoptions = +
    set OptionList     = ^(Options, 0)
    set OptionTextList = ^(OptionsText$($0), 1)
    set Status         = STATUS_SUCCESSFUL

finish_ReturnOptions = +
    Return $(Status) $(OptionList) $(OptionTextList)

;
; InstallOption:
;
; FUNCTION:  To copy files representing OEM Options
;            To configure the installed option
;            To update the registry for the installed option
;
; INPUT:     $($0):  Language to use
;            $($1):  OptionID to install
;            $($2):  SourceDirectory
;            $($3):  AddCopy  (YES | NO)
;            $($4):  DoCopy   (YES | NO)
;            $($5):  DoConfig (YES | NO)
;
; OUTPUT:    $($R0): STATUS: STATUS_SUCCESSFUL |
;                            STATUS_NOLANGUAGE |
;                            STATUS_USERCANCEL |
;                            STATUS_FAILED
;

[InstallOption]

    ;
    ; Set default values
    ;
    set Status   = STATUS_FAILED
	set !STF_OVERWRITE = "OVERWRITE=OLDER"
    set DrivesToFree = {}
    ;
    ; extract parameters
    ;
    set Option   = $($1)
    ifstr(i) $(!NTN_InstallMode) != deinstall
	    set SrcDir = $($2)#(LanguagesSupported, $($0), 1)
	else
		set SrcDir = $($2) 
	endif
    set AddCopy  = $($3)
    set DoCopy   = $($4)
    set DoConfig = $($5)

    ifstr(i) $(!NTN_InstallMode) != deinstall
	    ;
	    ; Check if the language requested is supported
	    ;
	    set LanguageList = ^(LanguagesSupported, 0)
	    Ifcontains(i) $($0) in $(LanguageList)
	    else
	        set Status = STATUS_NOLANGUAGE
	        goto finish_InstallOption
	    endif
	    read-syms Strings$($0)
		detect date
	else
		;
		;  $($0) is always ENG
		;  if we deinstall a different language, we 
		;  have to explicitly construct it
		;
		read-syms Strings*(^(LanguagesSupported, 0), 1)
	endif

    ;
    ; check to see if Option is supported.
    ;

    set OptionList = ^(Options, 0)
    ifcontains $(Option) in $(OptionList)
    else
        goto finish_InstallOption
    endif
    set OptionList = ""

    Ifstr(i) $(!NTN_InstallMode) == install
		set InstallOrUpdate = YES
	else-ifstr(i) $(!NTN_InstallMode) == update
		set InstallOrUpdate = YES
	else
		set InstallOrUpdate = NO
	endif
	    
	ifstr(i) $(InstallOrUpdate) == YES

		ifstr(i) $(!NTN_InstallMode) == update
    		OpenRegKey $(!REG_H_LOCAL) "" $(KeyName) $(!REG_KEY_READ) KeyProduct
			ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
				Debug-Output "NPRINTER.INF: Cannot open product key."
				goto errorconfig
			endif

            GetRegValue $(KeyProduct) "MajorVersion" MajorValue
            set Major = *($(MajorValue),4)
            GetRegValue $(KeyProduct) "MinorVersion" MinorValue
            set Minor = *($(MinorValue),4)
			CloseRegKey $(KeyProduct)

			ifint $(Major) > $(MajorVersion)
				set UpToDate = YES
			else-ifint	$(Major) == $(MajorVersion)
				ifint $(Minor) >= $(MinorVersion)
					set UpToDate = YES
				endif
			endif

			ifstr(i) $(UpToDate) == YES
				shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) WARNING $(MsgUpdateWarning)
				goto configdone
			endif
		endif

	    ;
	    ; Code to add files to copy list
	    ;

	    ifstr(i) $(AddCopy) == "YES"

            ifstr(i) $(!STF_GUI_UNATTENDED) != "YES"
	            shell "subroutn.inf" DoAskSourceEx $(SrcDir) $(String1)
	            ifint $($ShellCode) != $(!SHELL_CODE_OK)
	                Debug-Output "NPRINTER.INF: shelling DoAskSourceEx failed"
	                goto finish_InstallOption
	            endif

	            ifstr(i) $($R0) == STATUS_SUCCESSFUL
	                set SrcDir = $($R1)
	                ifstr(i) $($R2) != ""
	                    set DrivesToFree = >($(DrivesToFree), $($R2))
	                endif
	            else
	                Debug-Output "NPRINTER.INF: User cancelled asking source."
	                goto finish_InstallOption
	            endif
            endif

            install Install-AddCopyOption
            ifstr(i) $(STF_INSTALL_OUTCOME) != "STF_SUCCESS"
                Debug-Output "NPRINTER.INF: Adding NPrinter files to copy list failed"
                goto finish_InstallOption
            endif

	    endif
			
	    ifstr(i) $(DoCopy) == "YES"

	        read-syms ProgressCopy$($0)
	        install Install-DoCopyOption
	        ifstr(i) $(STF_INSTALL_OUTCOME) == "STF_FAILURE"
	            Debug-Output "NPRINTER.INF: Copying files failed."
	            goto finish_InstallOption
	        else-ifstr(i) $(STF_INSTALL_OUTCOME) == "STF_USERQUIT"
	            Debug-Output "NPRINTER.INF: User quit copying files."
	            set Status = STATUS_USERCANCEL
	            goto finish_InstallOption
	        endif

	    endif


		ifstr(i) $(!NTN_InstallMode) == update
    		OpenRegKey $(!REG_H_LOCAL) "" $(KeyName) $(!REG_KEY_WRITE) KeyProduct
			ifint $(RegLastError) != $(!REG_ERROR_SUCCESS)
				shell "subroutn.inf" SetupMessage $($0) STATUS $(RegLastError)" "$(KeyName)
				Debug-Output "NPRINTER.INF: Cannot open product key."
				goto errorconfig
			endif
	        set NewValueList = {{SoftwareType,0,$(!REG_VT_SZ),$(SoftwareType)},+
	                           {MajorVersion,0,$(!REG_VT_DWORD),$(MajorVersion)},+
	                           {MinorVersion,0,$(!REG_VT_DWORD),$(MinorVersion)},+
	                           {Title,0,$(!REG_VT_SZ),$(Title)},+
	                           {Description,0,$(!REG_VT_SZ),$(Description)},+
	                           {ServiceName,0,$(!REG_VT_SZ),$(Option)},+
	                           {OperationsSupport,0,$(!REG_VT_DWORD),$(OperationsSupport)}, +
	                           {InstallDate,0,$(!REG_VT_DWORD),*($(Now),1)}}
	        Shell  "utility.inf" AddValueList $(KeyProduct) $(NewValueList)
			CloseRegKey $(KeyProduct)
	        ifint $($ShellCode) != $(!SHELL_CODE_OK)
				shell "subroutn.inf" SetupMessage $($0) STATUS $($ShellCode)" "$(NewValueList)
	            Debug-Output "NPRINTER.INF: ShellCode error."
	            goto errorconfig
	        endif
	        ifstr(i) $($R0) != STATUS_SUCCESSFUL
				shell "subroutn.inf" SetupMessage $($0) STATUS $($R0)" "$(NewValueList)
	            Debug-Output "NPRINTER.INF: ShellCode error."
	            goto errorconfig
	        endif
	    
	    else-ifstr(i) $(DoConfig) == "YES"

	        ;
	        ; first run a privilege check on modifying the setup node
	        ;
			

	        shell "registry.inf" CheckSetupModify
	        ifint $($ShellCode) != $(!SHELL_CODE_OK)
	            goto finish_InstallOption
	        endif

	        ifstr(i) $($R0) != STATUS_SUCCESSFUL
	            goto finish_InstallOption
	        endif

	        ;
	        ; then make a new NPrinter service entry
	        ;

	        ifstr(i) $(Option) != ""

				ifstr(i) $(!STF_CONTROLSET) == ""
					set !STF_CONTROLSET = "CurrentControlSet"
				endif

	            set ServiceNode   = $(Option)
	            set ServiceBinary = %SystemRoot%\System32\#(Files-NPrinterService, $(Option), 2)

	            set Type             = $(#(Options, $(Option), 1))
	            set ErrorControl     = $(#(Options, $(Option), 2))
	            set EventMessageFile =   #(Options, $(Option), 3)
	            set TypesSupported   =   #(Options, $(Option), 4)

	            set Dependencies = ^(#(Options, $(Option), 0)"Dependencies", 1)
				
	            set ServicesValues   = { +
	                    {Type,           0, $(!REG_VT_DWORD),     $(Type)                  }, +
	                    {Start,          0, $(!REG_VT_DWORD),     $(!SERVICE_AUTO_START)   }, +
	                    {Group,          0, $(!REG_VT_SZ),        ""                       }, +
						{Dependencies,   0, $(!REG_VT_MULTI_SZ),  $(Dependencies)          }, +
	                    {ErrorControl,   0, $(!REG_VT_DWORD),     $(ErrorControl)          }, +
	                    {BinaryPathName, 0, $(!REG_VT_EXPAND_SZ), $(ServiceBinary)         }  +
	                    }
	            set ParametersValues = ""
	            set DeviceValues     = {}
	            set EventLogValues   = { +
	                    {EventMessageFile, 0, $(!REG_VT_EXPAND_SZ), $(EventMessageFile) }, +
	                    {TypesSupported,   0, $(!REG_VT_DWORD),     $(TypesSupported)   }  +
	                    }

	            shell "registry.inf"  MakeServicesEntry $(ServiceNode)      +
	                                                    $(ServicesValues)   +
	                                                    $(ParametersValues) +
	                                                    $(DeviceValues)     +
	                                                    $(EventLogValues)   +
	                                                    Parameters


	            ifint $($ShellCode) != $(!SHELL_CODE_OK)
	                Debug-Output "NPRINTER.INF: Couldn't execute MakeServicesEntry in registry.inf"
	                goto errorconfig
	            endif

	            ifstr(i) $($R0) != STATUS_SUCCESSFUL
	                Debug-Output "NPRINTER.INF: MakeServicesEntry failed for NPrinter: "$($R0)
	                goto errorconfig
	            endif
	        endif
	    	Split-String $(STF_CONTEXTINFNAME) "\" InfList
	    	QueryListSize InfListSize, $(InfList)
			set InfLeafName = *($(InfList), $(InfListSize))

			shell "utility.inf" InstallSoftwareProduct $(Manufacturer) $(Option) $(InfLeafName)
		    Ifstr(i) $($R0) == NO_ERROR
		        set KeyVersion  = $($R1)
		        set KeyNetRules = $($R2)
		        Shell "utility.inf", LinkToService, $(KeyVersion), $(Option), service
		        Ifstr(i) $($R0) != NO_ERROR
		            goto errorconfig
		        endif
				SetRegValue $(KeyNetRules) {InfOption, 0, $(!REG_VT_SZ), $(Option)}
				CloseRegKey $(KeyNetRules)

		        set NewValueList = {{SoftwareType,0,$(!REG_VT_SZ),$(SoftwareType)},+
		                           {MajorVersion,0,$(!REG_VT_DWORD),$(MajorVersion)},+
		                           {MinorVersion,0,$(!REG_VT_DWORD),$(MinorVersion)},+
		                           {Title,0,$(!REG_VT_SZ),$(Title)},+
		                           {Description,0,$(!REG_VT_SZ),$(Description)},+
		                           {ServiceName,0,$(!REG_VT_SZ),$(Option)},+
		                           {OperationsSupport,0,$(!REG_VT_DWORD),$(OperationsSupport)}, +
		                           {InstallDate,0,$(!REG_VT_DWORD),*($(Now),1)}}
		        Shell  "utility.inf" AddValueList $(KeyVersion) $(NewValueList)
		        ifint $($ShellCode) != $(!SHELL_CODE_OK)
		            Debug-Output "NPRINTER.INF: ShellCode error."
					CloseRegKey $(KeyVersion)
		            goto errorconfig
		        endif
				CloseRegKey $(KeyVersion)

		    endif
		endif ; DoConfig
	    goto configdone

	else-ifstr(i) $(!NTN_InstallMode) == deinstall
		;
		; Cleanup Software and Services keys
		;
        Shell "utility.inf" RemoveSoftwareComponent $(Manufacturer) $(Option)
        ifint $($ShellCode) != $(!SHELL_CODE_OK)
           Debug-Output "NPRINTER.INF: ShellCode error"
           goto errorconfig
        endif 
	    goto configdone

	else
		Debug-Output "NPRINTER.INF:Option "$(!NTN_InstallMode)" not available. "$(AddCopy)" "$(DoCopy)" "$(DoConfig)
    endif	  ; NTN_InstallMode
errorconfig = +
        goto finish_InstallOption


configdone = +


    set Status = STATUS_SUCCESSFUL

finish_InstallOption = +
    ForListDo $(DrivesToFree)
        LibraryProcedure STATUS,$(!LIBHANDLE), DeleteNetConnection $($) "TRUE"
    EndForListDo
    Return $(Status)

[Install-AddCopyOption]


    set STF_VITAL = ""
    ;
    ; Add the files to the copy list
    ;
    AddSectionKeyFileToCopyList   Files-NPrinterService         +
                                  $(Option)                     +
                                  $(SrcDir)                     +
                                  $(!STF_WINDOWSSYSPATH)

    AddSectionKeyFileToCopyList   Files-NPrinterINF             +
                                  $(Option)                     +
                                  $(SrcDir)                     +
                                  $(!STF_WINDOWSSYSPATH)

    AddSectionKeyFileToCopyList   Files-NPrinterApplet          +
                                  $(Option)                     +
                                  $(SrcDir)                     +
                                  $(!STF_WINDOWSSYSPATH)

    AddSectionKeyFileToCopyList   Files-NPrinterHelp            +
                                  $(Option)                     +
                                  $(SrcDir)                     +
                                  $(!STF_WINDOWSPATH)\Help

    exit


[Install-DoCopyOption]

    ;
    ; Copy files in the copy list
    ;
    CopyFilesInCopyList
    exit

;**************************************************************************
; PROGRESS GAUGE VARIABLES
;**************************************************************************

[ProgressCopyGER]
    ProCaption   = "Windows NT Setup"
    ProCancel    = "Abbrechen"
    ProCancelMsg = "Windows NT wurde nicht korrekt installiert.  Sind Sie sicher, daß Sie "+
                   "den Kopiervorgang abbrechen möchten?"
    ProCancelCap = "Setupnachricht"
    ProText1     = "Kopiere:"
    ProText2     = "Nach:"

[date]
    Now = {} ? $(!LIBHANDLE) GetSystemDate

[StringsGER]
    String1           = "Bitte geben Sie den vollen Pfad zu den NPrinter "+
                        "Dienst-Dateien an.  Wählen Sie anschließend Fortsetzen."
	Manufacturer      = "Novell"
	MajorVersion      = "1"
	MinorVersion      = "0"
	SoftwareType      = "service"
	OperationsSupport = "133"
	Version           = $(MajorVersion)"."$(MinorVersion)
	KeyName           = $(!NTN_SoftwareBase)"\"$(Manufacturer)"\"$(Option)"\CurrentVersion"
	Title             = "Novell NPrinter für Windows NT"
	Description       = $(Title)" ermöglicht die gemeinsame Nutzung lokal " +
	                    "angeschlossener Drucker im Novell-Netzwerk"
	MsgUpdateWarning  = $(!NTN_InfOption)" ist bereits auf aktuellem Stand."

;-----------------------------------------------------------------------
; SOURCE MEDIA DESCRIPTIONS
; -------------------------
; The OEM should list all the diskette labels here.  The source media
; description is used during copy to prompt the user for a diskette
; if the source is diskettes.
;
; Use 1 = "Diskette 1 Label" , TAGFILE = disk1
;     2 = "Diskette 2 Label" , TAGFILE = disk2
;     ...
;-----------------------------------------------------------------------
[Source Media Descriptions]
    1  = "NPrinter Disk 1"  , TAGFILE = NPrinter.001

[Files-NPrinterService]
NPrinter = 1, nprinter.exe

[Files-NPrinterApplet]
NPrinter = 1, nprinter.cpl

[Files-NPrinterHelp]
NPrinter = 1, nprinter.hlp, OVERWRITE=VERIFYSOURCEOLDER

[Files-NPrinterINF]
NPrinter = 1, oemnsvnp.inf, OVERWRITE=VERIFYSOURCEOLDER
[ RETURN TO DIRECTORY ]