--- mstools/rpc_dos/disk1/rpcsdk.mst 2018/08/09 18:21:16 1.1.1.2 +++ mstools/rpc_dos/disk1/rpcsdk.mst 2018/08/09 18:23:12 1.1.1.3 @@ -31,11 +31,15 @@ CONST EXITQUIT = 600 CONST DlgWelcome = 100 CONST DlgInstallOptions = 800 CONST HlpInstallOptions = 801 +CONST DlgNSInstallOptions = 802 +CONST HlpNSInstallOptions = 803 CONST EXITSUCCESS = 700 '$else CONST DlgWelcome = 2600 CONST DlgInstallOptions = 2400 CONST HlpInstallOptions = 2401 +CONST DlgNSInstallOptions = 802 +CONST HlpNSInstallOptions = 803 CONST EXITSUCCESS = 2800 '$endif @@ -52,6 +56,7 @@ CONST DlgNetBiosProtocols = 2300 CONST HlpNetBiosProtocols = 2301 CONST DlgNewProtocol = 2100 CONST HlpNewProtocol = 2101 +CONST DlgNewNS = 2150 CONST DlgAutoPath = 2400 CONST HlpAutoPath = 2401 CONST BADPATH = 6400 @@ -73,6 +78,7 @@ GLOBAL BasePath$ ''Default destin GLOBAL RegPath$ ''Default destination directory. GLOBAL DosPath$ ''Default destination directory. Global CustomInstall ''Custom install option +Global CustomNSInstall ''Custom Name Service install option Global SrcDir$ Global AllTransports Global MSDOSRuntime @@ -84,6 +90,9 @@ Global SamplesSDK Global HelpFiles GLOBAL CUIDLL$ GLOBAL HELPPROC$ +Global ThreeEightySixEnh +Global ThreeEightySixEnhStr$ +Global TCP DECLARE Function GetPath(Dialog%, Path$) AS INTEGER DECLARE FUNCTION GetTransport() As INTEGER @@ -116,8 +125,13 @@ INIT: SetAbout "RPC SDK Install", "By stevez - Version 0.09" CustomInstall = FALSE + CustomNSInstall = FALSE AllTransports = TRUE MSDOSRuntime = TRUE + ThreeEightySixEnh = FALSE + TCP = FALSE + ThreeEightySixEnhStr$="[386Enh]" + '$ifndef WINDOWS_ONLY MSDOSSDK = TRUE @@ -187,6 +201,57 @@ OPTION: end if RESTART_OPTION: + sz$ = UIStartDlg(CUIDLL$, DlgNSInstallOptions, "FRadioDlgProc", HlpNSInstallOptions, HELPPROC$) + Index$ = GetSymbolValue("ButtonChecked") + + if sz$ = "CONTINUE" THEN + UIPop(1) + elseif sz$ = "REACTIVATE" THEN + GOTO RESTART_OPTION + else + GOSUB ASKQUIT + GOTO OPTION + end if + + if Index$ = "2" then + i%=DoMsgBox("The only other supported name service provider is the DCE Cell Directory Service.", "DCE Name Service Provider.", MB_OK) + CustomNSInstall = TRUE + + NSProt$ = "\Protocol=ncacn_ip_tcp" + NSEndpoint$ = "\Endpoint=" + NSDefaultSyntax$ = "\DefaultSyntax=3" + + 'The following has to be handled by a dialog box. +NEWNS: + sz$ = UIStartDlg(CUIDLL$, DlgNewNS, "FNameOrgDlgProc", HlpNewProtocol, HELPPROC$) + UIPop (1) + + if sz$ = "CONTINUE" then + t$ = GetSymbolValue("NameOut") + if t$ = "" then + i% = DoMsgBox("You must enter a valid Network Address.", "Custom Name Service Install", MB_OK+MB_TASKMODAL+MB_ICONHAND) + goto NEWNS + end if + + NSNetworkAddress$ = "\NetworkAddress="+t$ + + t$ = GetSymbolValue("OrgOut") + if t$ = "" then + i% = DoMsgBox("You must enter a valid Server Network Address.", "Custom Name Service Install", MB_OK+MB_TASKMODAL+MB_ICONHAND) + goto NEWNS + end if + NSServerNetworkAddress$ = "\ServerNetworkAddress="+t$ + else + GOTO RESTART_OPTION + end if + else + CustomNSInstall = FALSE + NSProt$ = "\Protocol=ncacn_np" + NSNetworkAddress$ = "\NetworkAddress=\\." + NSEndpoint$ = "\Endpoint=\pipe\locator" + NSDefaultSyntax$ = "\DefaultSyntax=3" + end if + sz$ = UIStartDlg(CUIDLL$, DlgInstallOptions, "FRadioDlgProc", HlpInstallOptions, HELPPROC$) Index$ = GetSymbolValue("ButtonChecked") @@ -224,6 +289,7 @@ RESTART_OPTION: end if + '$ifndef RUNTIMEINSTALL SDK_OPTION: @@ -293,10 +359,10 @@ RESTART_SDK_OPTION: WindowsRuntime = WindowsSDK if MSDOSSDK = FALSE and WindowsSDK = FALSE then - i% = DoMsgBox("You must chose either MS-DOS or Windows.", "Include and Library Support", MB_OK+MB_TASKMODAL+MB_ICONHAND) - goto SDK_OPTION + goto FullInstall end if + '$endif RUNTIME_OPTION: @@ -434,7 +500,8 @@ RESTART_NETBIOS_OPTION: elseif Index$ = "2" then - AddListItem "NetBiosMap", "tcpip=0" + AddListItem "NetBiosMap", "tcp=0" + TCP = TRUE goto FullInstall end if @@ -459,6 +526,12 @@ GET_LANA: sz$ = UIStartDlg(CUIDLL$, DlgNewProtocol, "FNameOrgDlgProc", HlpNewProtocol, HELPPROC$) if sz$ = "CONTINUE" then + t$ = GetSymbolValue("NameOut") + + if mid$(t$,1) <> "nb" and mid$(t$, 1) <> "tcp" and mid$(t$, 1) <> "ipx" then + i% = DoMsgBox("The protocol string must be nb, tcp or ipx.", "NetBios Protocol", MB_OK+MB_TASKMODAL+MB_ICONHAND) + goto GET_LANA + endif t$ = GetSymbolValue("OrgOut") @@ -466,10 +539,26 @@ GET_LANA: i% = DoMsgBox("Bad value for Lana #, use 0 to 9", "NetBios Protocol", MB_OK+MB_TASKMODAL+MB_ICONHAND) goto GET_LANA else - NewProto$ = GetSymbolValue("NameOut") + "=" + t$ - AddListItem "ListItemsIn", NewProto$ + NewProto$ = GetSymbolValue("NameOut") + if mid$(NewProto$,1) = "tcp" then + TCP = TRUE + NewProto$="tcp=" + t$ + elseif mid$(NewProto$,1) = "ipx" then + NewProto$="ipx=" + t$ + else + NewProto$ = GetSymbolValue("NameOut") + "=" + t$ + endif + + for i% = 1 to GetListLength("ListItemsIn") step 1 + t$ = GetListItem("ListItemsIn", i%) + if t$ = NewProto$ then + goto SKIP_NEWPROTO_ADD + end if + next + AddListItem "ListItemsIn", NewProto$ end if +SKIP_NEWPROTO_ADD: end if UIPop (2) @@ -497,7 +586,7 @@ GET_LANA: GOTO RESTART_NETBIOS_PROTOCOL end if - CopyList "NetBiosMap", "ListItemsOut", TRUE + CopyList "NetBiosMap", "ListItemsIn", TRUE FullInstall: @@ -507,6 +596,7 @@ FullInstall: '$ifndef RUNTIMEINSTALL CreateDir BasePath$, cmoNone + CreateDir MakePath(BasePath$, "rpc"), cmoNone AddSectionFilesToCopyList "Base", SrcDir$, MakePath(BasePath$, "rpc") @@ -536,41 +626,22 @@ FullInstall: if SamplesSDK then - if MSDOSSDK and HelpFiles then - AddSectionFilesToCopyList "dHelp", SrcDir$, MakePath(BasePath$, "help") - end if - - if WindowsSDK and HelpFiles then + if HelpFiles then AddSectionFilesToCopyList "wHelp", SrcDir$, MakePath(BasePath$, "help") - CreateProgmanItem group$, "RPC API Reference", "winhelp "+MakePath(BasePath$, "help\rpc10wh.hlp"), "", cmoOverWrite - CreateProgmanItem group$, "RPC MIDL Reference", "winhelp "+MakePath(BasePath$, "help\midl10wh.hlp"), "", cmoOverWrite + CreateProgmanItem group$, "RPC Reference", "winhelp "+MakePath(BasePath$, "help\rpc.hlp"), "", cmoOverWrite end if CreateDir MakePath(BasePath$, "rpc\samples"), cmoNone - Open MakePath(BasePath$, "rpc\samples\makefile.dos") for Output As 1 - print #1, "# Nmake include file for MS-DOS sample applications" - print #1, - print #1, "OSINCLUDE="+MakePath(BasePath$, "include\dos") - close #1 - - Open MakePath(BasePath$, "rpc\samples\makefile.win") for Output As 1 - print #1, "# Nmake include file for Windows sample applications" - print #1, - print #1, "OSINCLUDE="+MakePath(BasePath$, "include\win") - close #1 - - - if WindowsSDK then + if SamplesSDK then AddSectionFilesToCopyList "wsample2", SrcDir$, MakePath(BasePath$, "rpc\samples\whello") AddSectionFilesToCopyList "wsample11", SrcDir$, MakePath(BasePath$, "rpc\samples\mandel") - end if - if MSDOSSDK then CreateDir MakePath(BasePath$, "rpc\samples\data"), cmoNone CreateDir MakePath(BasePath$, "rpc\samples\handles"), cmoNone + AddSectionFilesToCopyList "sample0", SrcDir$, MakePath(BasePath$, "rpc\samples") AddSectionFilesToCopyList "sample1", SrcDir$, MakePath(BasePath$, "rpc\samples\hello") AddSectionFilesToCopyList "sample3", SrcDir$, MakePath(BasePath$, "rpc\samples\data\dunion") AddSectionFilesToCopyList "sample4", SrcDir$, MakePath(BasePath$, "rpc\samples\data\inout") @@ -580,6 +651,12 @@ FullInstall: AddSectionFilesToCopyList "sample8", SrcDir$, MakePath(BasePath$, "rpc\samples\handles\cxhndl") AddSectionFilesToCopyList "sample9", SrcDir$, MakePath(BasePath$, "rpc\samples\handles\usrdef") AddSectionFilesToCopyList "sample10",SrcDir$, MakePath(BasePath$, "rpc\samples\dict") + AddSectionFilesToCopyList "sample12",SrcDir$, MakePath(BasePath$, "rpc\samples\callback") + AddSectionFilesToCopyList "sample13",SrcDir$, MakePath(BasePath$, "rpc\samples\ns\nhello") + AddSectionFilesToCopyList "sample14",SrcDir$, MakePath(BasePath$, "rpc\samples\yield") + AddSectionFilesToCopyList "sample15",SrcDir$, MakePath(BasePath$, "rpc\samples\cluuid") + AddSectionFilesToCopyList "sample16",SrcDir$, MakePath(BasePath$, "rpc\samples\ns\cds") + end if @@ -591,13 +668,14 @@ FullInstall: ' Update the list of transports to install. if AllTransports then + TCP = TRUE RemoveSymbol "SelectedTransports" end if if WindowsRuntime then AddSectionFilesToCopyList "wruntime", SrcDir$, MakePath(WinPath$, "system") - WinSysPath$ = MakePath(WinPath$, "system") + WinSysPath$ = GetWindowsSysDir() verdllPath$ = FindFileInTree("ver.dll", WinSysPath$) @@ -605,19 +683,44 @@ FullInstall: AddSectionFilesToCopyList "wruntime", SrcDir$, WinSysPath$ endif + 'Handle installation of netapi.dll variants. NetapiPath$ = FindTargetOnEnvVar("netapi.dll", "PATH") + 'Lanman Environments. Be sure not to overwrite NT WOW netapi.dll if NetapiPath$ <> "" then - i% = DoMsgBox("If your netapi.dll is an older version, it will be renamed to netapi.old and a newer version installed.", "Note on Netapi.dll", MB_OK) - AddSectionFilesToCopyList "wnetapi", SrcDir$, mid$(NetapiPath$, 1, len(NetapiPath$) - len("\netapi.dll")) - BackupFile NetapiPath$, "netapi.old" + if instr (NetapiPath$, "SYSTEM32")= 0 then + i% = DoMsgBox("If your netapi.dll is an older version, it will be renamed to netapi.old and a newer version installed.", "Note on Netapi.dll", MB_OK) + AddSectionFilesToCopyList "wnetapi", SrcDir$, mid$(NetapiPath$, 1, len(NetapiPath$) - len("\netapi.dll")) + BackupFile NetapiPath$, "netapi.old" + end if + else - WinballNetapiPath$ = FindTargetOnEnvVar("netapi.dll", WinSysPath$) - if WinballNetapiPath$ <> "" then + 'NON Lanman Environments + WinballNetapiPath$ = FindFileInTree("netapi.dll", WinSysPath$) + if WinballNetapiPath$ = "" then AddSectionFilesToCopyList "dummynetapi", SrcDir$, WinSysPath$ else - i% = DoMsgBox("Setup assumes you are running Windows For WorkGroups, so netapi.dll won't be updated.", "Note on Netapi.dll", MB_OK) - endif + l& = GetSizeOfFile(WinballNetapiPath$) + if l > 2000 then + i% = DoMsgBox("Setup assumes you are running Windows For WorkGroups, so netapi.dll won't be updated.", "Note on Netapi.dll", MB_OK) + end if + end if + end if + + + ' See if NEW tcp transport .dll is around. If not, copy OLD interface. + if TCP then + NewTcpDllPath$ = FindFileInTree("winsock.dll", WinPath$) + + if NewTcpDllPath$ = "" then + NewTcpDllPath$ = FindTargetOnEnvVar("winsock.dll", "PATH") + end if + + if NewTcpDllPath$ = "" then + AddSectionFilesToCopyList "oldtcpwin", SrcDir$, WinSysPath$ + else + AddSectionFilesToCopyList "newtcpwin", SrcDir$, WinSysPath$ + end if end if if AllTransports then @@ -657,15 +760,21 @@ FullInstall: ' Now write the registry file with the NSI values and the ' transport to protocol mappings. - KeyPrefix$ = "\Root\Software\Microsoft\Rpc" + KeyPrefix$ = "\Root\Software\Microsoft\Rpc" + NameService$ = KeyPrefix$+"\NameService" CreateDir RegPath$, cmoNone Open MakePath(RegPath$, "rpcreg.dat") for Output As 1 - print #1, KeyPrefix$+"\NameService\Protocol=ncacn_np" - print #1, KeyPrefix$+"\NameService\NetworkAddress=\\." - print #1, KeyPrefix$+"\NameService\Endpoint=\pipe\locator" - print #1, KeyPrefix$+"\NameService\DefaultSyntax=1" + if CustomNSInstall = TRUE then + print #1, NameService$+NSServerNetworkAddress$ + end if + + print #1, NameService$+NSProt$ + print #1, NameService$+NSNetworkAddress$ + print #1, NameService$+NSEndpoint$ + print #1, NameService$+NSDefaultSyntax$ + ' For each transport add the mapping for the protocols. @@ -688,6 +797,7 @@ FullInstall: AddListItem "MappedProtocols", mapping$ ' NetBios protocols get special mappings for each protocol + ' The ClientProtocols are now hardcoded for ip_tcp, dnet_nsp and nb_nb. if instr(mapping$, "rpcltc5") then for n% = 1 to GetListLength("NetBiosMap") step 1 @@ -696,10 +806,13 @@ FullInstall: prot$ = mid$(NbMap$, 1, instr(NbMap$, "=")-1) dll$ = mid$(mapping$, instr(mapping$, "=")) - print #1, KeyPrefix$+"\ClientProtocols\ncacn_nb_"+prot$+dll$ + if prot$ <> "nb" then + print #1, KeyPrefix$+"\ClientProtocols\ncacn_nb_"+prot$+dll$ + end if + next - else - print #1, KeyPrefix$+"\ClientProtocols\ncacn_"+mapping$ + 'else + ' print #1, KeyPrefix$+"\ClientProtocols\ncacn_"+mapping$ end if NextMapping: @@ -721,6 +834,10 @@ NextMapping: Close #1 + ' See if we are installing in nt. The string NtDir is used for system.ini update too. + + NtDir$ = WinPath$ + "system32" + ' Update the users autoexec file if needed. AutoExec$ = "C:\" @@ -731,11 +848,11 @@ NextMapping: UpdateReg = FALSE end if - UpdatePath = FALSE + UpdatePath = TRUE if MSDOSRuntime then -' i% = DoMsgBox("Path: "+path$, "DOS path: "+DosPath$, MB_OK+MB_TASKMODAL+MB_ICONHAND) +' i% = DoMsgBox("Path: "+path$, "DOS path: "+DosPath$, MB_OK+MB_TASKMODAL+MB_ICONHAND) if instr(path$, Ucase$(DosPath$)) = 0 then UpdatePath = TRUE @@ -748,14 +865,21 @@ NextMapping: AutoExec$ = AutoExec$+"Autoexec.bat" - while DoesFileExist(AutoExec$, femExists) = 0 + newPath$ = "SET PATH=%PATH%;"+DosPath$ + + if DoesFileExist(AutoExec$, femExists) = 0 then - if not GetPath(DlgAutoPath, AutoExec$) then - goto noAutoExec + i% = DoMsgBox("No Autoexec.bat found !!!, "+ AutoExec$ + " needs to be created. Do you want to create this file?", "Create "+ AutoExec$, 4+MB_TASKMODAL+32) + + if i% = 6 then + Open AutoExec$ for Output As 1 + print #1, "" + close #1 + i% = DoMsgBox("An updated "+AutoExec$+" is in the file "+AutoExec$, "New Autoexec.bat", MB_OK+MB_TASKMODAL) end if - wend - newPath$ = "SET PATH=%PATH%;"+DosPath$ + end if + ' Insert the new information by merging the new info while ' copying the autoexec file. @@ -771,7 +895,7 @@ NextMapping: if len(Buffer$) = 0 then print #2, Buffer$ - elseif UpdatePath and instr (Ucase$(Buffer$), Ucase$(Newpath$)) then + elseif UpdatePath and instr (Ucase$(Buffer$), Ucase$(Newpath$)) and instr (Ucase$(Buffer$), Ucase$(Basepath$)) then UpdatePath = FALSE elseif UpdateReg and instr(Ucase$(Buffer$), "RPC_REG_DATA_FILE") then @@ -788,11 +912,11 @@ NextMapping: ' Append any needed values to the autoexe file if UpdateReg then - print #2, "set RPC_REG_DATA_FILE="+RegPath$ + print #2, "set RPC_REG_DATA_FILE="+MakePath(RegPath$, "rpcreg.dat") end if if UpdatePath then - print #2, NewPath$ + print #2, NewPath$+";"+BasePath$+"\bin" end if Close #1, #2 @@ -802,14 +926,18 @@ NextMapping: goto NoAutoExec end if - i% = DoMsgBox("In order for the runtime to function, setup needs to change your autoexec.bat file. Do you want setup to update this file?", "Update Autoexec.bat", 4+MB_TASKMODAL+32) +'$ifndef RUNTIMEINSTALL + i% = DoMsgBox("In order for the runtime and compiler to function, "+ AutoExec$ + " needs to be changed. Do you want to update this file?", "Update "+ AutoExec$, 4+MB_TASKMODAL+32) +'$else + i% = DoMsgBox("In order for the runtime to function, setup needs to change "+ AutoExec$ + ". Do you want setup to update this file?", "Update "+ AutoExec$, 4+MB_TASKMODAL+32) +'$endif if i% = 6 then BackupFile AutoExec$, "Autoexec.bak" CopyFile AutoExecRpc$, AutoExec$, cmoOverwrite, FALSE RemoveFile AutoExecRpc$, cmoNone else - i% = DoMsgBox("An updated auotexec.bat file is in the file "+AutoExecRpc$, "New Autoexec.bat", MB_OK+MB_TASKMODAL) + i% = DoMsgBox("An updated "+AutoExec$+" is in the file "+AutoExecRpc$, "New Autoexec.bat", MB_OK+MB_TASKMODAL) end if endif @@ -824,6 +952,68 @@ NoAutoExec: RemoveFile verdllPath$, cmoVital endif +'Update the users windows\system.ini if required + + SystemIni$ = WinPath$ + "system.ini" + SystemIniRpc$ = mid$(SystemIni$, 1, len(SystemIni$) - 3)+"rpc" + + while DoesFileExist(SystemIni$, femExists) = 0 + goto NoSystemIni + wend + + while not DoesDirExist(NtDir$) = 0 + goto NoSystemIni + wend + + Open SystemIni$ for Input as 1 + Open SystemIniRpc$ for Output as 2 + +'$ifndef RUNTIMEINSTALL + + 'Look for [386Enh] while writing all but c7 drivers. + while not eof(1) + line input #1, Buffer$ + + if 0 = instr(Ucase$(Buffer$), Ucase$("=*vmcpd")) and 0 = instr(Ucase$(Buffer$), Ucase$("vpfd.386")) then + print #2, Buffer$ + end if + + 'If found [386Enh], then print c7 device drivers + if instr(Ucase$(Buffer$), Ucase$(ThreeEightySixEnhStr$)) then + print #2, "device=*vmcpd" + print #2, "device="+BasePath$+"\bin\vpfd.386" + ThreeEightySixEnh = 1 + end if + + wend + + 'If [386Enh] not found, so drivers not written, handle here. + if ThreeEightySixEnh <> 1 then + print #2, "[386Enh]" + print #2, "device=*vmcpd" + print #2, BasePath$+"\vpfd.386" + ThreeEightySixEnh = 1 + end if + + close #1 + close #2 + +'Now ask if they want the new system.ini + + i% = DoMsgBox("In order for the compiler to function, setup needs to change your system.ini file. Do you want setup to update this file?", "Update Windows system.ini", 4+MB_TASKMODAL+32) + + if i% = 6 then + BackupFile SystemIni$, "System.bak" + CopyFile SystemIniRpc$, SystemIni$, cmoOverwrite, FALSE + RemoveFile AutoExecRpc$, cmoNone + i% = DoMsgBox("Be sure to restart windows, so that the changes in system.ini can take effect. ", "Changes in Windows system.ini", 4+MB_TASKMODAL+32) + else + i% = DoMsgBox("An updated system.ini is in the file "+SystemIniRpc$, "New system.ini", MB_OK+MB_TASKMODAL) + end if + +'$endif + +NoSystemIni: '$ifdef SystemNetApi if ReStartListEmpty() = 0 then @@ -840,6 +1030,11 @@ NoAutoExec: QUIT: ON ERROR GOTO ERRQUIT + OldNetapiPath$ = FindTargetOnEnvVar("netapi.old", "PATH") + + if OldNetapiPath$ <> "" then + BackupFile OldNetapiPath$, "netapi.dll" + end if if ERR = 0 THEN dlg% = EXITSUCCESS @@ -1109,10 +1304,6 @@ function GetHlpSize () static AS String if HelpFiles then - if MSDOSSDK then - AddSectionFilesToCopyList "dHelp", SrcDir$, BasePath$ - end if - if WindowsSDK then AddSectionFilesToCopyList "wHelp", SrcDir$, BasePath$ end if