[300分] 跪求servU组件更新修改信息的相关资料 代码 等=================在线等 急急急~~~~~~~~

zcm123 2004-08-14 09:44:07
修改ini已经完成了 可servu就是不刷新修改ini文件后的信息! 我用vb编的组建 郁闷阿!

如何编servu组件的更新信息部分阿?!

我愿高分换一servu的组件代码
...全文
329 34 打赏 收藏 转发到动态 举报
写回复
用AI写文章
34 条回复
切换为时间正序
请发表友善的回复…
发表回复
TSD 2005-04-12
  • 打赏
  • 举报
回复
mark
zcm123 2004-09-28
  • 打赏
  • 举报
回复
感谢大家 下面结帖
笨狗先飞 2004-09-17
  • 打赏
  • 举报
回复
inifile.cls
去找这个类文件吧,网上有下载的,觉得操作ini还比较方便
zcm123 2004-09-17
  • 打赏
  • 举报
回复
我是准备做成asp组件然后用asp调用
zcm123 2004-09-17
  • 打赏
  • 举报
回复
不好意思 前一振子病了没工作呵呵


谢谢各位了 我的程序在本地测试通过了 但是一联结到服务器上就找不到ini文件了

请问如何编写阿? 还有您的删除user是如何写的??我的方法效率很低。

谢谢!
fuzq 2004-09-17
  • 打赏
  • 举报
回复

'' ==========================================================
' 开发人员:dengxue.com
' 编写时间:2004-3-28
' 函数名称:WriteINI(ByVal Section As String, ByVal Key As String, ByVal KeyValue As String, ByVal inipath As String) As Integer
' 参数说明:Section 段名
' Key 键名
' KeyValue 键值
' inipath INI文件路径
' 功能说明:读INI文件
' Function returns 1 if successful and 0 if unsuccessful
'

'' ==========================================================

Public Function ReadINI(ByVal Section As String, ByVal Key As String, ByVal inipath As String) As String
Dim RetStr As String

If Dir(inipath) = "" Then Exit Function
RetStr = String(255, Chr(0))
ReadINI = Left(RetStr, GetPrivateProfileString(Section, ByVal Key, "", RetStr, Len(RetStr), inipath))
End Function

'' ==========================================================
' 开发人员:dengxue.com
' 编写时间:2004-3-28
' 函数名称:WriteINI(ByVal Section As String, ByVal Key As String, ByVal KeyValue As String, ByVal inipath As String) As Integer
' 参数说明:Section 段名
' Key 键名
' KeyValue 键值
' inipath INI文件路径
' 功能说明:写INI文件
' Function returns 1 if successful and 0 if unsuccessful
'

'' ==========================================================
Public Function WriteINI(ByVal Section As String, ByVal Key As String, ByVal KeyValue As String, ByVal inipath As String) As Integer
If Dir(inipath) = "" Then Exit Function
WritePrivateProfileString Section, Key, KeyValue, inipath
WriteINI = 1
End Function
笨狗先飞 2004-09-17
  • 打赏
  • 举报
回复
为什么不把程序位置指定,而要自己去找呢,一般这个程序装好后不太会移位置的
zcm123 2004-09-17
  • 打赏
  • 举报
回复
^_^
我问的是在服务器状态下找不到serv_u中的那个ServUAdmin.ini文件,至于对ini文件的操作我用我自己的类觉得没什么不方便的 呵呵

我的方法是不是有误阿?
用dll读取在服务器winnt目录下的xxopen.ini 文件中的
[zFilepath]
path="C:\Program Files\Serv-U\ServUDaemon.ini"
然后对其操作
但是显示重视找不到位于服务器上的这个ServUDaemon.ini文件。
someeyes 2004-08-20
  • 打赏
  • 举报
回复
我又找到了新的解决方法,不用重起服务了!你得履行诺言,给我分啊!
修改完.ini文件后在[GLOBAL]里加入一条ReloadSettings=True就都搞定了!
你要不履行诺言,可没有下回了!
someeyes 2004-08-19
  • 打赏
  • 举报
回复
这个我也知道!但好像也没什么其他办法!添加用户是不需要重起的!但是修改信息,不重起是不好使得重起也就几秒钟,几乎可以忽略不计,而且servU是支持断点续传的!其他的我也没有办法了!
zcm123 2004-08-19
  • 打赏
  • 举报
回复
这样的重起会影响到正在操作的ftp用户吗?比如有的在上传等?
zcm123 2004-08-19
  • 打赏
  • 举报
回复
谢谢
msn:zcm821214@hotmail.com
someeyes 2004-08-19
  • 打赏
  • 举报
回复
Public Enum e_ServiceType
e_ServiceType_Disabled = 4
e_ServiceType_Manual = 3
e_ServiceType_Automatic = 2
e_ServiceType_SystemStart = 1
e_ServiceType_BootTime = 0
End Enum

Private Const SERVICE_ERROR_NORMAL As Long = &H1

Public Enum e_ServiceControl
e_ServiceControl_Stop = &H1
e_ServiceControl_Pause = &H2
e_ServiceControl_Continue = &H3
e_ServiceControl_Interrogate = &H4
e_ServiceControl_Shutdown = &H5
End Enum

Public Enum e_ServiceState
e_ServiceState_Stopped = &H1
e_ServiceState_StartPending = &H2
e_ServiceState_StopPending = &H3
e_ServiceState_Running = &H4
e_ServiceState_ContinuePending = &H5
e_ServiceState_PausePending = &H6
e_ServiceState_Paused = &H7
End Enum

Private Type SERVICE_TABLE_ENTRY
lpServiceName As String
lpServiceProc As Long
lpServiceNameNull As Long
lpServiceProcNull As Long
End Type

Private Type SERVICE_STATUS
dwServiceType As Long
dwCurrentState As Long
dwControlsAccepted As Long
dwWin32ExitCode As Long
dwServiceSpecificExitCode As Long
dwCheckPoint As Long
dwWaitHint As Long
End Type

Private Type QUERY_SERVICE_CONFIG
dwServiceType As Long
dwStartType As Long
dwErrorControl As Long
lpBinaryPathName As Long 'String
lpLoadOrderGroup As Long ' String
dwTagId As Long
lpDependencies As Long 'String
lpServiceStartName As Long 'String
lpDisplayName As Long 'String
End Type

Private Declare Function QueryServiceConfig Lib "advapi32.dll" Alias "QueryServiceConfigA" (ByVal hService As Long, lpServiceConfig As Byte, ByVal cbBufSize As Long, pcbBytesNeeded As Long) As Long
Private Declare Function QueryServiceStatus Lib "advapi32.dll" (ByVal hService As Long, lpServiceStatus As SERVICE_STATUS) As Long
Private Declare Function OpenSCManager Lib "advapi32.dll" Alias "OpenSCManagerA" (ByVal lpMachineName As String, ByVal lpDatabaseName As String, ByVal dwDesiredAccess As Long) As Long
Declare Function OpenService Lib "advapi32.dll" Alias "OpenServiceA" (ByVal hSCManager As Long, ByVal lpServiceName As String, ByVal dwDesiredAccess As Long) As Long

Private Declare Sub CopyMemory Lib "KERNEL32" Alias "RtlMoveMemory" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
Private Declare Function lstrcpy Lib "KERNEL32" Alias "lstrcpyA" (ByVal lpString1 As String, ByVal lpString2 As Long) As Long

Declare Function CloseServiceHandle Lib "advapi32.dll" (ByVal hSCObject As Long) As Long

Public Function CheckServiceRunning(ByVal serviceName As String, Optional ByRef serviceRunning As e_ServiceState, Optional ByRef serviceStartType As e_ServiceType, Optional servicePath As String) As Boolean
Dim hSCM As Long
Dim hSVC As Long
Dim pSTATUS As SERVICE_STATUS
Dim udtConfig As QUERY_SERVICE_CONFIG
Dim lRet As Long
Dim lBytesNeeded As Long
Dim sTemp As String
Dim pFileName As Long

CheckServiceRunning = True
' Open The Service Control Manager
'
hSCM = OpenSCManager(vbNullString, vbNullString, SC_MANAGER_CONNECT)
If hSCM = 0 Then
CheckServiceRunning = False
End If

' Open the specific Service to obtain a handle
'
hSVC = OpenService(hSCM, Trim(serviceName), GENERIC_READ)
If hSVC = 0 Then
CheckServiceRunning = False
'MsgBox "Error - " & Err.LastDllError
GoTo CloseHandles
End If

' Fill the Service Status Structure
'
lRet = QueryServiceStatus(hSVC, pSTATUS)
If lRet = 0 Then
CheckServiceRunning = False
GoTo CloseHandles
End If

' Report the Current State
'
Select Case pSTATUS.dwCurrentState
Case SERVICE_STOP
serviceRunning = e_ServiceState_Stopped
Case SERVICE_START
serviceRunning = e_ServiceState_StartPending
Case SERVICE_STOP_PENDING
serviceRunning = e_ServiceState_StopPending
Case SERVICE_RUNNING
serviceRunning = e_ServiceState_Running
Case SERVICE_CONTINUE_PENDING
serviceRunning = e_ServiceState_ContinuePending
Case SERVICE_PAUSE_PENDING
serviceRunning = e_ServiceState_PausePending
Case SERVICE_PAUSED
serviceRunning = e_ServiceState_Paused
Case SERVICE_ACCEPT_STOP
serviceRunning = e_ServiceState_Stopped
Case SERVICE_ACCEPT_PAUSE_CONTINUE
serviceRunning = e_ServiceState_Paused
Case SERVICE_ACCEPT_SHUTDOWN
serviceRunning = e_ServiceState_StopPending
End Select

' Call QueryServiceConfig with 1 byte buffer to generate an error
' that returns the size of a buffer we need.
'
ReDim abConfig(0) As Byte
lRet = QueryServiceConfig(hSVC, abConfig(0), 0&, lBytesNeeded)
If lRet = 0 And Err.LastDllError <> ERROR_INSUFFICIENT_BUFFER Then
CheckServiceRunning = False
End If

' Redim our byte array to the size necessary and call
' QueryServiceConfig again
'
ReDim abConfig(lBytesNeeded) As Byte
lRet = QueryServiceConfig(hSVC, abConfig(0), lBytesNeeded, _
lBytesNeeded)
If lRet = 0 Then
CheckServiceRunning = False
GoTo CloseHandles
End If

' Fill our Service Config User Defined Type.
'
CopyMemory udtConfig, abConfig(0), Len(udtConfig)

serviceStartType = udtConfig.dwStartType

sTemp = Space(255)

' Now use the pointer obtained to copy the path into the temporary
' String Variable
'
lRet = lstrcpy(sTemp, udtConfig.lpBinaryPathName)
servicePath = Trim(sTemp)

CloseHandles:
' Close the Handle to the Service
'
CloseServiceHandle (hSVC)

' Close the Handle to the Service Control Manager
'
CloseServiceHandle (hSCM)
End Function

'重启Serv-U服务,使改动生效
Public Sub ReStartServer()
Dim serviceRunning As e_ServiceState
Shell "net stop serv-u", vbHide
Do
If CheckServiceRunning("serv-u", serviceRunning) = True Then
If serviceRunning = e_ServiceState_Stopped Then
Shell "net start serv-u", vbHide
Exit Do
End If
End If
DoEvents
Loop
'Ru = RunService("serv-u")
End Sub
someeyes 2004-08-19
  • 打赏
  • 举报
回复
修改ini的我就不发了,把我整理的重启ServU的代码给你发上去!
Private Const SERVICE_WIN32_OWN_PROCESS = &H10&
Private Const SERVICE_WIN32_SHARE_PROCESS = &H20&
Private Const SERVICE_WIN32 = SERVICE_WIN32_OWN_PROCESS + SERVICE_WIN32_SHARE_PROCESS

Private Const SC_MANAGER_CONNECT = &H1
Private Const SC_MANAGER_CREATE_SERVICE = &H2
Private Const SC_MANAGER_ENUMERATE_SERVICE = &H4
Private Const SC_MANAGER_LOCK = &H8
Private Const SC_MANAGER_QUERY_LOCK_STATUS = &H10
Private Const SC_MANAGER_MODIFY_BOOT_CONFIG = &H20

Private Const STANDARD_RIGHTS_REQUIRED = &HF0000
Private Const SERVICE_QUERY_CONFIG = &H1
Private Const SERVICE_CHANGE_CONFIG = &H2
Private Const SERVICE_QUERY_STATUS = &H4
Private Const SERVICE_ENUMERATE_DEPENDENTS = &H8
Private Const SERVICE_START = &H10
Private Const SERVICE_STOP = &H20
Private Const SERVICE_PAUSE_CONTINUE = &H40
Private Const SERVICE_INTERROGATE = &H80
Private Const SERVICE_USER_DEFINED_CONTROL = &H100
Private Const SERVICE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SERVICE_QUERY_CONFIG Or SERVICE_CHANGE_CONFIG Or SERVICE_QUERY_STATUS Or SERVICE_ENUMERATE_DEPENDENTS Or SERVICE_START Or SERVICE_STOP Or SERVICE_PAUSE_CONTINUE Or SERVICE_INTERROGATE Or SERVICE_USER_DEFINED_CONTROL)

Private Const SERVICE_CONTROL_CONTINUE = &H3
Private Const SERVICE_CONTROL_INTERROGATE = &H4
Private Const SERVICE_CONTROL_PAUSE = &H2
Private Const SERVICE_CONTROL_SHUTDOWN = &H5
Private Const SERVICE_CONTROL_STOP = &H1

Private Const SERVICE_STOPPED = &H1
Private Const SERVICE_START_PENDING = &H2
Private Const SERVICE_STOP_PENDING = &H3
Private Const SERVICE_RUNNING = &H4
Private Const SERVICE_CONTINUE_PENDING = &H5
Private Const SERVICE_PAUSE_PENDING = &H6
Private Const SERVICE_PAUSED = &H7
Private Const SERVICE_ACCEPT_STOP = &H1
Private Const SERVICE_ACCEPT_PAUSE_CONTINUE = &H2
Private Const SERVICE_ACCEPT_SHUTDOWN = &H4

Private Const SERVICE_DISABLED As Long = &H4
Private Const SERVICE_DEMAND_START As Long = &H3
Private Const SERVICE_AUTO_START As Long = &H2
Private Const SERVICE_SYSTEM_START As Long = &H1
Private Const SERVICE_BOOT_START As Long = &H0

Private Const GENERIC_READ = &H80000000
Private Const ERROR_INSUFFICIENT_BUFFER = 122
笨狗先飞 2004-08-16
  • 打赏
  • 举报
回复
我用的是odbc,修改了一次用户密码,结果有效
zcm123 2004-08-16
  • 打赏
  • 举报
回复
不起作用的
创建时起
当修改时不起
用CuteFTP可以测试出来

笨狗先飞 2004-08-16
  • 打赏
  • 举报
回复
用ODBC吧,数据导入到数据库里
数据可能在servu里显示不更新,不过,好象是起作用的
zcm123 2004-08-16
  • 打赏
  • 举报
回复
up
zcm123 2004-08-16
  • 打赏
  • 举报
回复
up
pandengzhe 2004-08-16
  • 打赏
  • 举报
回复
up
加载更多回复(14)

1,502

社区成员

发帖
与我相关
我的任务
社区描述
VB 网络编程
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧