搜索
查看: 1443|回复: 7

[求助] hlds怎么样作为2000的服务加入到系统中?

[复制链接]
发表于 2003-10-12 22:17:56 | 显示全部楼层 |阅读模式 来自 中国–河北–石家庄
如题
 楼主| 发表于 2003-10-17 21:18:06 | 显示全部楼层 来自 中国–河北–石家庄

没人管啊?

好像以前听说可以,不知道具体怎么做,谁做过讲一下吧。谢了(liao3)
回复

使用道具 举报

匿名  发表于 2003-10-22 11:18:44 来自 Invalid

我有资料,但是不知道怎么弄

去下载一个Win2kResourceKit(用GOOGLE搜一下)
然后把这些代码用记事本保存为*.VBS文件。
然后怎么龙我就不知道了,有谁能搞定的告诉一身。。
代码如下:
''''''''''''''''''''''''''''''''''''
'
' INSTSrv.VBS
'
' Author: TB1d
' Date:   2003-02-12
''''''''''''''''''''''''''''''''''''
Option Explicit
On Error Resume Next

''''''''''''''''''
' Main Code
''''''''''''''''''

Const OWN_PROCESS = 16
Const NOT_INTERACTIVE = False
Const NORMAL_ERROR_CONTROL = 1
Dim t_folder
Dim ShortName, DisplayName, PathName, StartMode, ServiceParameter, FullParameter
Dim oArgs, ArgNum
Dim errReturn
errReturn = 0


Set oArgs = WScript.Arguments
ArgNum = 0

While ArgNum < oArgs.Count
        FullParameter = FullParameter + oArgs(ArgNum)
        ArgNum = ArgNum + 1
Wend

Dim mPara,s
mPara = split(FullParameter,"/",-1)
For each s in mPara
        Select Case Left(s,3)
                Case "sn:"
                        ShortName = Right(s,Len(s) - 3)
                Case "dn:"
                        DisplayName = Right(s,Len(s) -3)
                Case "pn:"
                        PathName = Right(s,Len(s) -3)
                Case "sm:"
                        If Right(s,Len(s) -3) = 2 Then
                                StartMode = "Manual"
                        Else
                                StartMode = "Automatic"
                        End If
                               
                Case "sp:"
                        ServiceParameter = Right(s,Len(s) -3)
        End Select
Next

If Left(oArgs(0),2) = "/?" Then
        Call DisplayHelpMessage
Else
        WScript.Echo
        WScript.Echo Space(30) & UCase(WScript.ScriptName) & " By TB1d"
        WScript.Echo String(80, "_")
        Call ReportFileStatus("srvany.exe")
        Call DetPara
End If

'Test

''''''''''
' End Main
''''''''''



'DisplayHelpMessage


'''''''''''''''''''''''''''
' Test Code
'''''''''''''''''''''''''''
'Sub Test()
'        WScript.Echo ShortName
'        WScript.Echo DisplayName
'        WScript.Echo PathName
'        WScript.Echo StartMode
'        WScript.Echo ServiceParameter
'End Sub

'''''''''''''''''''''''''''
' Detect Parameter
'''''''''''''''''''''''''''
Sub DetPara()
        If IsEmpty(ShortName) or IsEmpty(DisplayName) or IsEmpty(PathName) or IsEmpty(StartMode) Then
                WScript.Echo String(80, "_")
                WScript.echo "Warning:Not Enough Parameters,Please Read The Follow Help Documents!"
                Call DisplayHelpMessage
                WScript.Quit
        Else
                Call CreateService(ShortName,DisplayName,StartMode)
                If errReturn = 0 Then
                        WScript.Echo String(80, "_")
                        WScript.Echo "Congratulations:The Service has Created Successfully.!"
                        Call RegEdit(ShortName,PathName,ServiceParameter)
                        WScript.Echo String(80, "_")
                        WScript.Echo "The Created Service Information:"
                        WScript.Echo "Service's ShortName: " & ShortName
                        WScript.Echo "Service's DisplayName: " & DisplayName
                        WScript.Echo "service's StartMode: " & StartMode
                        WScript.Echo "Service's Path: " & PathName
                        WScript.Echo "Service's Parmeter: " & ServiceParameter
                        WScript.Echo String(80, "_")
                        WScript.Echo "Now,you can use Net Start " & ShortName & " to Start the Service!"
                  

                       
                Else
                        WScript.Echo String(80, "_")
                        WScript.Echo "Warning:Can't Create The Service,Please Check the ShortName and the DisplayName."
                        WScript.Echo "        CheckStep:Start Menu-> Programme-> Administrate Tools -> Services"
                        WScript.Echo String(80, "_")
                End If
        End If
End Sub


'''''''''''''''''''''''''''
' Detect File: srvany.exe
'''''''''''''''''''''''''''
Sub ReportFileStatus(filespec)
        Dim fso, msg, dfolder
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set dfolder = fso.GetSpecialFolder(1)
   t_folder = dfolder & "\"
   If (fso.FileExists(t_folder & filespec)) Then
      msg = 1
   Else
      msg = 0
   End If
          
   If msg = 0 Then
           Wscript.Echo "Warning:The File " & filespec & " was not Found. " & Chr(10) & Space(8) & "Make sure that " & filespec & " Exist."
           fso.CopyFile "srvany.exe", t_folder
           WScript.Echo String(80, "_")
           WScript.Echo "The File " & filespec & " has copyed to target directory:" & t_folder
           WScript.Echo "Please run instsrv.vbs again!"
           Wscript.Quit
   Else
           Wscript.Echo "Step1:Detect " & filespec & " ! [OK]"
           WScript.Echo "Step2:Create Service..."
       
          
   End If
End Sub




'''''''''''''''''''''''''''''''''''''''
'Create Service
'''''''''''''''''''''''''''''''''''''''

Sub CreateService(sn,dn,sm)

Dim objWMIService, objService, strComputer

strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=Impersonate}!\\" & strComputer & "\root\cimv2")

Set objService = objWMIService.Get("Win32_Service")
errReturn = objService.Create(sn, dn, t_folder & "srvany.exe", OWN_PROCESS, NORMAL_ERROR_CONTROL, sm, NOT_INTERACTIVE, "LocalSystem")

End Sub                  

Sub RegEdit(sn,pn,sp)
        Dim WshShell
        Set WshShell = WScript.CreateObject("WScript.Shell")

        WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Services\" & sn & "\Parameters\Application", pn, "REG_SZ"
        If Not IsEmpty(sp) Then        WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Services\" & sn & "\Parameters\AppParameters", sp, "REG_SZ"
       
End Sub


''''''''''''''''''''''''''''
'
' Display Help Message
'
''''''''''''''''''''''''''''
Sub DisplayHelpMessage()
         WScript.Echo
         WScript.Echo Space(30) & UCase(WScript.ScriptName) & " By TB1d"
         WScript.Echo String(80, "_")
    WScript.Echo "Usage:"
    WScript.Echo "      instsrv.VBS /sn: /dn: /pn: /sm: [/sp:] "
    WScript.Echo
    WScript.Echo "Note:Must have the srvany.exe file! srvany.exe from Win2k ResKit! "
    WScript.Echo "Description:"
    WScript.Echo "This Code is an Service Add Tool.Because not every application can add "
    Wscript.Echo "to Windows 2000 Service,so,I wrote this vbs code,Maybe help you! ~_*"
    WScript.Echo
    WScript.Echo "The Parameter Description:"
    WScript.Echo "    +----------+---------------------------------------+"
    WScript.Echo "    |Parameter |         Parameter Descriptiong        |"
    WScript.Echo "    +----------+---------------------------------------+"
    WScript.Echo "    |   -sn:   | Short Name.                           |"
    WScript.Echo "    |   -dn:   | Display Name.                         |"
    WScript.Echo "    |   -pn:   | Path Name.                            |"
    WScript.Echo "    |   -sm:   | Start Mode. 1:Automatic 2:Manual      |"
    WScript.Echo "    |   -sp:   | Application Run Parameter. [optional] |"
    WScript.Echo "    +----------+---------------------------------------+"
    WScript.Echo "Samples:"
    WScript.Echo "  instsrv.VBS /sn:test /dn:""Test Notepad Server"" /pn:""c:\winnt\notepad.exe"" /sm:2 "
    WScript.Echo "  instsrv.VBS /sn:cs /dn:""CS1.5"" /pn:""d:\hl\hlds.exe"" /sm:1 /sp:""-game cstrike -port 27015 +maxplayers 22 +map de_dust -nomaster +sv_lan 1"
         WScript.Echo "For Help:"
         WScript.Echo "  instsrv.VBS /?"
End Sub

就这些了
匿名  发表于 2003-10-22 11:21:25 来自 Invalid
注意哪个人头是冒号和D哦,我不知道为什么会这样的!!!-_-!!
匿名  发表于 2003-10-22 11:24:47 来自 Invalid

干脆我发上来吧!

自己下载吧。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
发表于 2003-10-22 12:48:11 | 显示全部楼层 来自 中国–广西–百色
我现在就是 用服务来做CSF的
要不要我放给你那个文件
回复

使用道具 举报

发表于 2003-10-22 16:02:22 | 显示全部楼层 来自 中国–广东–江门
还是不要这样!!会影响WIN的稳定性的!
回复

使用道具 举报

发表于 2003-10-22 21:07:15 | 显示全部楼层 来自 中国–安徽–合肥
还是推荐用批处理方法, 搞个死循环,然后用start 启动,很爽,我现在基本上不用管了
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表